[gtk+/client-side-windows: 140/284] Remove the old workarond for broken tracking rects



commit e7eb75c0cad072969d351b76f132cbdbdae10591
Author: Richard Hult <richard imendio com>
Date:   Wed Jan 7 21:25:12 2009 +0100

    Remove the old workarond for broken tracking rects
    
    The one that puts windows outside the screen and moves them in when
    showing. It might not be needed anymore and the workaround doesn't
    work with the client-side window branch anyway because the window is
    already mapped when we get showed for some reason.
---
 gdk/quartz/GdkQuartzWindow.c  |   62 -----------------------------------------
 gdk/quartz/gdkwindow-quartz.c |   31 ++++++++------------
 2 files changed, 12 insertions(+), 81 deletions(-)

diff --git a/gdk/quartz/GdkQuartzWindow.c b/gdk/quartz/GdkQuartzWindow.c
index 44cfaee..627798d 100644
--- a/gdk/quartz/GdkQuartzWindow.c
+++ b/gdk/quartz/GdkQuartzWindow.c
@@ -142,17 +142,8 @@
   NSRect content_rect = [self contentRectForFrameRect:[self frame]];
   GdkWindow *window = [[self contentView] gdkWindow];
   GdkWindowObject *private = (GdkWindowObject *)window;
-  GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
   GdkEvent *event;
 
-  /* Ignore new position during showing/hiding the window, otherwise we
-   * would get the off-screen position that is used for hidden windows to
-   * get reliable MouseEntered events when showing them again. See comments
-   * in show() and hide().
-   */
-  if (inShowOrHide)
-    return;
-
   private->x = content_rect.origin.x;
   private->y = _gdk_quartz_window_get_inverted_screen_y (content_rect.origin.y + content_rect.size.height);
 
@@ -172,7 +163,6 @@
   NSRect content_rect = [self contentRectForFrameRect:[self frame]];
   GdkWindow *window = [[self contentView] gdkWindow];
   GdkWindowObject *private = (GdkWindowObject *)window;
-  GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
   GdkEvent *event;
 
   private->width = content_rect.size.width;
@@ -279,32 +269,8 @@
   GdkWindow *window = [[self contentView] gdkWindow];
   GdkWindowObject *private = (GdkWindowObject *)window;
   GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
-  gboolean was_hidden;
-  int requested_x = 0, requested_y = 0;
 
   inShowOrHide = YES;
-  was_hidden = FALSE;
-
-  if (!GDK_WINDOW_IS_MAPPED (window))
-    {
-      NSRect content_rect;
-      NSRect frame_rect;
-
-      was_hidden = TRUE;
-
-      /* We move the window in place if it's not mapped. See comment in
-       * hide().
-       */
-      content_rect =
-        NSMakeRect (private->x,
-                    _gdk_quartz_window_get_inverted_screen_y (private->y) - private->height,
-                    private->width, private->height);
-      frame_rect = [impl->toplevel frameRectForContentRect:content_rect];
-      [impl->toplevel setFrame:frame_rect display:NO];
-
-      requested_x = frame_rect.origin.x;
-      requested_y = frame_rect.origin.y;
-    }
 
   if (makeKey)
     [impl->toplevel makeKeyAndOrderFront:impl->toplevel];
@@ -312,20 +278,6 @@
     [impl->toplevel orderFront:nil];
 
   inShowOrHide = NO;
-
-  /* When the window manager didn't allow our request, update the position
-   * to what it really ended up as.
-   */
-  if (was_hidden)
-    {
-      NSRect frame_rect;
-
-      frame_rect = [impl->toplevel frame];
-      if (requested_x != frame_rect.origin.x || requested_y != frame_rect.origin.y)
-        {
-          [self windowDidMove:nil];
-        }
-    }
 }
 
 - (void)hide
@@ -333,23 +285,9 @@
   GdkWindow *window = [[self contentView] gdkWindow];
   GdkWindowObject *private = (GdkWindowObject *)window;
   GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
-  NSRect content_rect;
-  NSRect frame_rect;
 
   inShowOrHide = YES;
-
-  /* We move the window away when hiding, to make it possible to move it in
-   * place when showing to get reliable tracking rect events (which are used
-   * to generate crossing events). We have to do this, probably a bug in
-   * quartz.
-   */
-  content_rect = NSMakeRect (-500 - private->width, -500 - private->height,
-                             private->width, private->height);
-  frame_rect = [impl->toplevel frameRectForContentRect:content_rect];
-  [impl->toplevel setFrame:frame_rect display:NO];
-
   [impl->toplevel orderOut:nil];
-
   inShowOrHide = NO;
 }
 
diff --git a/gdk/quartz/gdkwindow-quartz.c b/gdk/quartz/gdkwindow-quartz.c
index 3b517e6..08a30af 100644
--- a/gdk/quartz/gdkwindow-quartz.c
+++ b/gdk/quartz/gdkwindow-quartz.c
@@ -872,13 +872,10 @@ _gdk_window_impl_new (GdkWindow     *window,
         int style_mask;
         const char *title;
 
-        /* Big hack: We start out outside the screen and move the
-         * window in before showing it. This makes the initial
-         * MouseEntered event work if the window ends up right under
-         * the mouse pointer, bad quartz.
-         */
-        content_rect = NSMakeRect (-500 - private->width, -500 - private->height,
-                                   private->width, private->height);
+        content_rect = NSMakeRect (private->x,
+                                   _gdk_quartz_window_get_inverted_screen_y (private->y) - private->height,
+                                   private->width,
+                                   private->height);
 
         if (attributes->window_type == GDK_WINDOW_TEMP ||
             attributes->type_hint == GDK_WINDOW_TYPE_HINT_SPLASHSCREEN)
@@ -911,6 +908,9 @@ _gdk_window_impl_new (GdkWindow     *window,
 	    [impl->toplevel setBackgroundColor:[NSColor clearColor]];
 	  }
 
+        content_rect.origin.x = 0;
+        content_rect.origin.y = 0;
+
 	impl->view = [[GdkQuartzView alloc] initWithFrame:content_rect];
 	[impl->view setGdkWindow:window];
 	[impl->toplevel setContentView:impl->view];
@@ -1288,19 +1288,12 @@ move_resize_window_internal (GdkWindow *window,
       NSRect content_rect;
       NSRect frame_rect;
 
-      /* We don't update the NSWindow while unmapped, since we move windows
-       * off-screen when hiding in order for MouseEntered to be triggered
-       * reliably when showing windows and they appear under the mouse.
-       */
-      if (GDK_WINDOW_IS_MAPPED (window))
-        {
-          content_rect =  NSMakeRect (private->x,
-                                      _gdk_quartz_window_get_inverted_screen_y (private->y + private->height),
-                                      private->width, private->height);
+      content_rect =  NSMakeRect (private->x,
+                                  _gdk_quartz_window_get_inverted_screen_y (private->y + private->height),
+                                  private->width, private->height);
 
-          frame_rect = [impl->toplevel frameRectForContentRect:content_rect];
-          [impl->toplevel setFrame:frame_rect display:YES];
-        }
+      frame_rect = [impl->toplevel frameRectForContentRect:content_rect];
+      [impl->toplevel setFrame:frame_rect display:YES];
     }
   else 
     {



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