Alexandre Julliard : winex11: Handle GravityNotify events for non-toplevel windows.

Alexandre Julliard julliard at winehq.org
Mon Nov 8 11:46:24 CST 2010


Module: wine
Branch: master
Commit: a8063e8b8bf586f79d97eeeab71411b5c0389da6
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a8063e8b8bf586f79d97eeeab71411b5c0389da6

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Nov  8 15:22:09 2010 +0100

winex11: Handle GravityNotify events for non-toplevel windows.

---

 dlls/winex11.drv/event.c  |   33 +++++++++++++++++++++++++++++++--
 dlls/winex11.drv/window.c |    2 +-
 2 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c
index a72a3cb..aa38179 100644
--- a/dlls/winex11.drv/event.c
+++ b/dlls/winex11.drv/event.c
@@ -95,6 +95,7 @@ static void X11DRV_ReparentNotify( HWND hwnd, XEvent *event );
 static void X11DRV_ConfigureNotify( HWND hwnd, XEvent *event );
 static void X11DRV_PropertyNotify( HWND hwnd, XEvent *event );
 static void X11DRV_ClientMessage( HWND hwnd, XEvent *event );
+static void X11DRV_GravityNotify( HWND hwnd, XEvent *event );
 
 struct event_handler
 {
@@ -129,7 +130,7 @@ static struct event_handler handlers[MAX_EVENT_HANDLERS] =
     { ReparentNotify,   X11DRV_ReparentNotify },
     { ConfigureNotify,  X11DRV_ConfigureNotify },
     /* ConfigureRequest */
-    /* GravityNotify */
+    { GravityNotify,    X11DRV_GravityNotify },
     /* ResizeRequest */
     /* CirculateNotify */
     /* CirculateRequest */
@@ -142,7 +143,7 @@ static struct event_handler handlers[MAX_EVENT_HANDLERS] =
     { MappingNotify,    X11DRV_MappingNotify },
 };
 
-static int nb_event_handlers = 19;  /* change this if you add handlers above */
+static int nb_event_handlers = 20;  /* change this if you add handlers above */
 
 
 /* return the name of an X event */
@@ -963,6 +964,34 @@ void X11DRV_ConfigureNotify( HWND hwnd, XEvent *xev )
 }
 
 
+/**********************************************************************
+ *           X11DRV_GravityNotify
+ */
+static void X11DRV_GravityNotify( HWND hwnd, XEvent *xev )
+{
+    XGravityEvent *event = &xev->xgravity;
+    struct x11drv_win_data *data = X11DRV_get_win_data( hwnd );
+    RECT rect;
+
+    if (!data) return;
+
+    rect.left   = event->x;
+    rect.top    = event->y;
+    rect.right  = rect.left + data->whole_rect.right - data->whole_rect.left;
+    rect.bottom = rect.top + data->whole_rect.bottom - data->whole_rect.top;
+
+    TRACE( "win %p/%lx new X rect %d,%d,%dx%d (event %d,%d)\n",
+           hwnd, data->whole_window, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top,
+           event->x, event->y );
+
+    X11DRV_X_to_window_rect( data, &rect );
+
+    if (data->window_rect.left != rect.left || data ->window_rect.top != rect.top)
+        SetWindowPos( hwnd, 0, rect.left, rect.top, 0, 0,
+                      SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOCOPYBITS );
+}
+
+
 /***********************************************************************
  *           get_window_wm_state
  */
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
index 7e96a39..1005ad2 100644
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -2371,7 +2371,7 @@ void CDECL X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags
     if (thread_data->current_event && thread_data->current_event->xany.window == data->whole_window)
         event_type = thread_data->current_event->type;
 
-    if (event_type != ConfigureNotify && event_type != PropertyNotify)
+    if (event_type != ConfigureNotify && event_type != PropertyNotify && event_type != GravityNotify)
         event_type = 0;  /* ignore other events */
 
     if (data->mapped)




More information about the wine-cvs mailing list