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.
This commit is contained in:
Richard Hult
2009-01-07 21:25:12 +01:00
committed by Alexander Larsson
parent 257dea55a7
commit e7eb75c0ca
2 changed files with 12 additions and 81 deletions

View File

@ -142,17 +142,8 @@
NSRect content_rect = [self contentRectForFrameRect:[self frame]]; NSRect content_rect = [self contentRectForFrameRect:[self frame]];
GdkWindow *window = [[self contentView] gdkWindow]; GdkWindow *window = [[self contentView] gdkWindow];
GdkWindowObject *private = (GdkWindowObject *)window; GdkWindowObject *private = (GdkWindowObject *)window;
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
GdkEvent *event; 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->x = content_rect.origin.x;
private->y = _gdk_quartz_window_get_inverted_screen_y (content_rect.origin.y + content_rect.size.height); 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]]; NSRect content_rect = [self contentRectForFrameRect:[self frame]];
GdkWindow *window = [[self contentView] gdkWindow]; GdkWindow *window = [[self contentView] gdkWindow];
GdkWindowObject *private = (GdkWindowObject *)window; GdkWindowObject *private = (GdkWindowObject *)window;
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
GdkEvent *event; GdkEvent *event;
private->width = content_rect.size.width; private->width = content_rect.size.width;
@ -279,32 +269,8 @@
GdkWindow *window = [[self contentView] gdkWindow]; GdkWindow *window = [[self contentView] gdkWindow];
GdkWindowObject *private = (GdkWindowObject *)window; GdkWindowObject *private = (GdkWindowObject *)window;
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->impl); GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
gboolean was_hidden;
int requested_x = 0, requested_y = 0;
inShowOrHide = YES; 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) if (makeKey)
[impl->toplevel makeKeyAndOrderFront:impl->toplevel]; [impl->toplevel makeKeyAndOrderFront:impl->toplevel];
@ -312,20 +278,6 @@
[impl->toplevel orderFront:nil]; [impl->toplevel orderFront:nil];
inShowOrHide = NO; 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 - (void)hide
@ -333,23 +285,9 @@
GdkWindow *window = [[self contentView] gdkWindow]; GdkWindow *window = [[self contentView] gdkWindow];
GdkWindowObject *private = (GdkWindowObject *)window; GdkWindowObject *private = (GdkWindowObject *)window;
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->impl); GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
NSRect content_rect;
NSRect frame_rect;
inShowOrHide = YES; 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]; [impl->toplevel orderOut:nil];
inShowOrHide = NO; inShowOrHide = NO;
} }

View File

@ -872,13 +872,10 @@ _gdk_window_impl_new (GdkWindow *window,
int style_mask; int style_mask;
const char *title; const char *title;
/* Big hack: We start out outside the screen and move the content_rect = NSMakeRect (private->x,
* window in before showing it. This makes the initial _gdk_quartz_window_get_inverted_screen_y (private->y) - private->height,
* MouseEntered event work if the window ends up right under private->width,
* the mouse pointer, bad quartz. private->height);
*/
content_rect = NSMakeRect (-500 - private->width, -500 - private->height,
private->width, private->height);
if (attributes->window_type == GDK_WINDOW_TEMP || if (attributes->window_type == GDK_WINDOW_TEMP ||
attributes->type_hint == GDK_WINDOW_TYPE_HINT_SPLASHSCREEN) attributes->type_hint == GDK_WINDOW_TYPE_HINT_SPLASHSCREEN)
@ -911,6 +908,9 @@ _gdk_window_impl_new (GdkWindow *window,
[impl->toplevel setBackgroundColor:[NSColor clearColor]]; [impl->toplevel setBackgroundColor:[NSColor clearColor]];
} }
content_rect.origin.x = 0;
content_rect.origin.y = 0;
impl->view = [[GdkQuartzView alloc] initWithFrame:content_rect]; impl->view = [[GdkQuartzView alloc] initWithFrame:content_rect];
[impl->view setGdkWindow:window]; [impl->view setGdkWindow:window];
[impl->toplevel setContentView:impl->view]; [impl->toplevel setContentView:impl->view];
@ -1288,19 +1288,12 @@ move_resize_window_internal (GdkWindow *window,
NSRect content_rect; NSRect content_rect;
NSRect frame_rect; NSRect frame_rect;
/* We don't update the NSWindow while unmapped, since we move windows content_rect = NSMakeRect (private->x,
* off-screen when hiding in order for MouseEntered to be triggered _gdk_quartz_window_get_inverted_screen_y (private->y + private->height),
* reliably when showing windows and they appear under the mouse. private->width, private->height);
*/
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);
frame_rect = [impl->toplevel frameRectForContentRect:content_rect]; frame_rect = [impl->toplevel frameRectForContentRect:content_rect];
[impl->toplevel setFrame:frame_rect display:YES]; [impl->toplevel setFrame:frame_rect display:YES];
}
} }
else else
{ {