Skip to content

Commit c1abb10

Browse files
committed
Avoid including windows.h in the public headers needlessly
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.
1 parent 0d09e95 commit c1abb10

File tree

7 files changed

+13
-11
lines changed

7 files changed

+13
-11
lines changed

examples/tvdemo/gadgets.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "gadgets.h"
3333

3434
#if !defined( __BORLANDC__ ) && defined( _WIN32 )
35+
#include <tvision/compat/windows/windows.h>
3536
#include <psapi.h>
3637
#endif
3738

examples/tvforms/datacoll.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ __link( RStringCollection )
2727
#include <string.h>
2828
#endif // __STRING_H
2929

30+
#if !defined( __STDLIB_H )
31+
#include <stdlib.h>
32+
#endif // __STDLIB_H
33+
3034
const char * const TDataCollection::name = "TDataCollection";
3135

3236
void TDataCollection::write( opstream& os )

include/pch.h

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#define Uses_TApplication
22
#define Uses_TDialog
33
#include <tvision/tv.h>
4+
#include <tvision/compat/windows/windows.h>
45
#include <unordered_map>
56
#include <memory>
67
#include <string>

include/tvision/internal/findfrst.h

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#include <unistd.h>
1212
#include <dirent.h>
1313
#include <sys/stat.h>
14+
#else
15+
#include <tvision/compat/windows/windows.h>
1416
#endif
1517

1618
namespace tvision

include/tvision/system.h

+1-10
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,9 @@ const int mwRight = 0x08;
5757

5858
/* Mouse event flags */
5959

60-
#if !defined( __FLAT__ )
6160
const int meMouseMoved = 0x01;
6261
const int meDoubleClick = 0x02;
63-
#else
64-
#if !defined( __WINDOWS_H )
65-
#include <tvision/compat/windows/windows.h>
66-
#endif
67-
const int meMouseMoved = MOUSE_MOVED; // NT values from WINDOWS.H
68-
const int meDoubleClick = DOUBLE_CLICK;
69-
#endif
70-
// 0x04 and 0x08 are reserved by NT (MOUSE_WHEELED, MOUSE_HWHEELED).
71-
const int meTripleClick = 0x10;
62+
const int meTripleClick = 0x04;
7263

7364
#endif // __EVENT_CODES
7465

source/platform/ansidisp.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#include <internal/ansidisp.h>
2-
#include <internal/stdioctl.h>
32
#include <internal/strings.h>
43
#include <stdlib.h>
54

source/tvision/tdircoll.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@
3030
#include <dos.h>
3131
#endif // __DOS_H
3232

33+
#if defined( _WIN32 ) && defined( __FLAT__ )
34+
#include <tvision/compat/windows/windows.h>
35+
#endif
36+
3337
#pragma warn -asc
3438

3539
Boolean driveValid( char drive ) noexcept

0 commit comments

Comments
 (0)