]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Process Windows non-input messages only during vblank.
authorToni Wilen <twilen@winuae.net>
Sat, 18 Dec 2021 17:49:15 +0000 (19:49 +0200)
committerToni Wilen <twilen@winuae.net>
Sat, 18 Dec 2021 17:49:15 +0000 (19:49 +0200)
include/inputdevice.h
include/xwin.h
inputdevice.cpp
od-win32/win32.cpp

index 0e7aeae01ebed2b6c5bf89d612995325b1e206b0..bae3230b1422e1323a23d5439f2da252146b6b2e 100644 (file)
@@ -237,6 +237,7 @@ extern void mousehack_wakeup(void);
 extern void mousehack_write(int reg, uae_u16 val);
 extern void setmouseactive(int monid, int);
 extern bool ismouseactive(void);
+extern void inputdevice_read_msg(bool);
 
 extern void setmousebuttonstateall (int mouse, uae_u32 buttonbits, uae_u32 buttonmask);
 extern void setjoybuttonstateall (int joy, uae_u32 buttonbits, uae_u32 buttonmask);
index add1b131d79b38894a1ec9f38aacdfb796e6c261..fb53898635c98ef52857187af64277c074e53c48 100644 (file)
@@ -25,7 +25,7 @@ extern int graphics_init (bool);
 extern void graphics_leave(void);
 extern void graphics_reset(bool);
 extern bool handle_events (void);
-extern int handle_msgpump (void);
+extern int handle_msgpump (bool);
 extern void setup_brkhandler (void);
 extern int isfullscreen (void);
 extern void toggle_fullscreen(int monid, int);
index 56ce79daa9962daa5fbfbe01839d42376c512ea5..93424b64137818b95b337a89e04fd945455c23d9 100644 (file)
@@ -2254,7 +2254,7 @@ static bool get_mouse_position(int *xp, int *yp, int inx, int iny)
        x = inx;
        y = iny;
 
-       getgfxoffset(0, &fdx, &fdy, &fmx, &fmy);
+       getgfxoffset(monid, &fdx, &fdy, &fmx, &fmy);
 
        //write_log("%.2f*%.2f %.2f*%.2f\n", fdx, fdy, fmx, fmy);
 
@@ -3206,17 +3206,22 @@ static void joymousecounter (int joy)
 
 static int inputread;
 
-static void inputdevice_read(void)
+void inputdevice_read_msg(bool vblank)
 {
-//     if ((inputdevice_logging & (2 | 4)))
-//             write_log(_T("INPUTREAD\n"));
        int got2 = 0;
        for (;;) {
-               int got = handle_msgpump();
+               int got = handle_msgpump(vblank);
                if (!got)
                        break;
                got2 = 1;
        }
+}
+
+static void inputdevice_read(void)
+{
+//     if ((inputdevice_logging & (2 | 4)))
+//             write_log(_T("INPUTREAD\n"));
+       inputdevice_read_msg(false);
        if (inputread <= 0) {
                idev[IDTYPE_MOUSE].read();
                idev[IDTYPE_JOYSTICK].read();
@@ -3957,7 +3962,7 @@ void inputdevice_hsync (bool forceread)
                while (inprec_playevent (&nr, &state, &max, &autofire))
                        handle_input_event (nr, state, max, (autofire ? HANDLE_IE_FLAG_AUTOFIRE : 0) | HANDLE_IE_FLAG_PLAYBACKEVENT);
                if (vpos == 0)
-                       handle_msgpump ();
+                       handle_msgpump(true);
        }
        if (!input_record && !input_play) {
                if (forceread) {
index b7b2e25b81e011e3cfea1f02f7a594175d47879b..5116be335b360e63b09df9305a7b6aff97ce1468 100644 (file)
@@ -3068,15 +3068,19 @@ static LRESULT CALLBACK BlankWindowProc (HWND hWnd, UINT message, WPARAM wParam,
        return DefWindowProc (hWnd, message, wParam, lParam);
 }
 
-int handle_msgpump (void)
+int handle_msgpump(bool vblank)
 {
-       int got = 0;
        MSG msg;
+       int got = 0;
 
-       while (PeekMessage (&msg, 0, 0, 0, PM_REMOVE)) {
+       UINT wRemoveMsg = PM_REMOVE | PM_NOYIELD | PM_QS_INPUT;
+       if (vblank) {
+               wRemoveMsg |= PM_QS_PAINT | PM_QS_POSTMESSAGE | PM_QS_SENDMESSAGE;
+       }
+       while (PeekMessage(&msg, 0, 0, 0, wRemoveMsg)) {
                got = 1;
-               TranslateMessage (&msg);
-               DispatchMessage (&msg);
+               TranslateMessage(&msg);
+               DispatchMessage(&msg);
        }
        while (checkIPC (globalipc, &currprefs));
        return got;