[gtk/wip.win32.fixes: 23/25] gdkevents-win32.c: Clean up WM_ACTIVATE handling a bit




commit 60a07f3739153b3c4dd45ce7b1714143827f86b5
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Tue Sep 8 16:09:46 2020 +0800

    gdkevents-win32.c: Clean up WM_ACTIVATE handling a bit
    
    We can group some things together, to make things a little bit more clear

 gdk/win32/gdkevents-win32.c | 48 ++++++++++++++++++++++++---------------------
 1 file changed, 26 insertions(+), 22 deletions(-)
---
diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c
index da39f88b9a..e2424f4741 100644
--- a/gdk/win32/gdkevents-win32.c
+++ b/gdk/win32/gdkevents-win32.c
@@ -3276,34 +3276,38 @@ gdk_event_translate (MSG *msg,
          break;
        }
 
-      if (LOWORD (msg->wParam) == WA_INACTIVE && msg->lParam != 0)
+      if (LOWORD (msg->wParam) == WA_INACTIVE)
         {
-          GdkSurface *other_surface = gdk_win32_handle_table_lookup ((HWND) msg->lParam);
-          if (other_surface != NULL &&
-              (GDK_IS_POPUP (other_surface) || GDK_IS_DRAG_SURFACE (other_surface)))
+          if (msg->lParam != 0)
             {
-              /* We're being deactivated in favour of some popup or temp window.
-               * Since only toplevels can have visual focus, pretend that
-               * nothing happened.
-               */
-              *ret_valp = 0;
-              return_val = TRUE;
-              break;
+               GdkSurface *other_surface = gdk_win32_handle_table_lookup ((HWND) msg->lParam);
+               if (other_surface != NULL &&
+                   (GDK_IS_POPUP (other_surface) || GDK_IS_DRAG_SURFACE (other_surface)))
+                {
+                  /* We're being deactivated in favour of some popup or temp window.
+                   * Since only toplevels can have visual focus, pretend that
+                   * nothing happened.
+                   */
+                  *ret_valp = 0;
+                  return_val = TRUE;
+                  break;
+                }
             }
-        }
 
-      if (LOWORD (msg->wParam) == WA_INACTIVE)
-       gdk_synthesize_surface_state (window, GDK_SURFACE_STATE_FOCUSED, 0);
+          gdk_synthesize_surface_state (window, GDK_SURFACE_STATE_FOCUSED, 0);
+        }
       else
-       gdk_synthesize_surface_state (window, 0, GDK_SURFACE_STATE_FOCUSED);
+        {
+          gdk_synthesize_surface_state (window, 0, GDK_SURFACE_STATE_FOCUSED);
+
+          /* Bring any tablet contexts to the top of the overlap order when
+           * one of our windows is activated.
+           * NOTE: It doesn't seem to work well if it is done in WM_ACTIVATEAPP
+           * instead
+           */
+          _gdk_input_set_tablet_active ();
+        }
 
-      /* Bring any tablet contexts to the top of the overlap order when
-       * one of our windows is activated.
-       * NOTE: It doesn't seem to work well if it is done in WM_ACTIVATEAPP
-       * instead
-       */
-      if (LOWORD(msg->wParam) != WA_INACTIVE)
-       _gdk_input_set_tablet_active ();
       break;
 
     case WM_ACTIVATEAPP:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]