Skip to content

Commit

Permalink
Avoid including windows.h in the public headers needlessly
Browse files Browse the repository at this point in the history
Although the 'meMouseMoved' and 'meDoubleClick' mouse event flags match NT values, whether they are set or not depends exclusively on the TEventQueue::getMouseEvent function, so there is actually no direct relation between these flags and the NT values.
  • Loading branch information
magiblot committed Oct 21, 2024
1 parent 0d09e95 commit c1abb10
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 11 deletions.
1 change: 1 addition & 0 deletions examples/tvdemo/gadgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "gadgets.h"

#if !defined( __BORLANDC__ ) && defined( _WIN32 )
#include <tvision/compat/windows/windows.h>
#include <psapi.h>
#endif

Expand Down
4 changes: 4 additions & 0 deletions examples/tvforms/datacoll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ __link( RStringCollection )
#include <string.h>
#endif // __STRING_H

#if !defined( __STDLIB_H )
#include <stdlib.h>
#endif // __STDLIB_H

const char * const TDataCollection::name = "TDataCollection";

void TDataCollection::write( opstream& os )
Expand Down
1 change: 1 addition & 0 deletions include/pch.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#define Uses_TApplication
#define Uses_TDialog
#include <tvision/tv.h>
#include <tvision/compat/windows/windows.h>
#include <unordered_map>
#include <memory>
#include <string>
2 changes: 2 additions & 0 deletions include/tvision/internal/findfrst.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#include <unistd.h>
#include <dirent.h>
#include <sys/stat.h>
#else
#include <tvision/compat/windows/windows.h>
#endif

namespace tvision
Expand Down
11 changes: 1 addition & 10 deletions include/tvision/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,9 @@ const int mwRight = 0x08;

/* Mouse event flags */

#if !defined( __FLAT__ )
const int meMouseMoved = 0x01;
const int meDoubleClick = 0x02;
#else
#if !defined( __WINDOWS_H )
#include <tvision/compat/windows/windows.h>
#endif
const int meMouseMoved = MOUSE_MOVED; // NT values from WINDOWS.H
const int meDoubleClick = DOUBLE_CLICK;
#endif
// 0x04 and 0x08 are reserved by NT (MOUSE_WHEELED, MOUSE_HWHEELED).
const int meTripleClick = 0x10;
const int meTripleClick = 0x04;

#endif // __EVENT_CODES

Expand Down
1 change: 0 additions & 1 deletion source/platform/ansidisp.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include <internal/ansidisp.h>
#include <internal/stdioctl.h>
#include <internal/strings.h>
#include <stdlib.h>

Expand Down
4 changes: 4 additions & 0 deletions source/tvision/tdircoll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
#include <dos.h>
#endif // __DOS_H

#if defined( _WIN32 ) && defined( __FLAT__ )
#include <tvision/compat/windows/windows.h>
#endif

#pragma warn -asc

Boolean driveValid( char drive ) noexcept
Expand Down

0 comments on commit c1abb10

Please sign in to comment.