Improve the tracking rect updating: - No need to override setFrame. - Use

2007-06-30  Richard Hult  <richard@imendio.com>

	* gdk/quartz/GdkQuartzView.c: Improve the tracking rect updating:
	- No need to override setFrame.
	- Use our own size instead of the bounds from for the view as it's
	not always updated before the tracking rect.
	- Only reset the tracking rect if the new window is nil).
	
	* gdk/quartz/GdkQuartzWindow.c: Update the bounds of the content
	view when the window size changes.

svn path=/trunk/; revision=18309
This commit is contained in:
Richard Hult 2007-06-30 08:56:50 +00:00 committed by Richard Hult
parent a3b1739796
commit 8fd51a225e
3 changed files with 22 additions and 9 deletions

View File

@ -1,3 +1,14 @@
2007-06-30 Richard Hult <richard@imendio.com>
* gdk/quartz/GdkQuartzView.c: Improve the tracking rect updating:
- No need to override setFrame.
- Use our own size instead of the bounds from for the view as it's
not always updated before the tracking rect.
- Only reset the tracking rect if the new window is nil).
* gdk/quartz/GdkQuartzWindow.c: Update the bounds of the content
view when the window size changes.
2007-06-30 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkbuilderparser.c (_gtk_builder_parse_boolean):

View File

@ -1,6 +1,6 @@
/* GdkQuartzView.m
*
* Copyright (C) 2005 Imendio AB
* Copyright (C) 2005-2007 Imendio AB
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -117,6 +117,7 @@
{
GdkWindowObject *private = GDK_WINDOW_OBJECT (gdk_window);
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
NSRect rect;
if (trackingRect)
{
@ -127,7 +128,12 @@
if (!impl->toplevel)
return;
trackingRect = [self addTrackingRect:[self bounds]
/* Note, if we want to set assumeInside we can use:
* NSPointInRect ([[self window] convertScreenToBase:[NSEvent mouseLocation]], rect)
*/
rect = NSMakeRect (0, 0, impl->width, impl->height);
trackingRect = [self addTrackingRect:rect
owner:self
userData:nil
assumeInside:NO];
@ -143,19 +149,13 @@
-(void)viewWillMoveToWindow:(NSWindow *)newWindow
{
if ([self window] && trackingRect)
if (newWindow == nil && trackingRect)
{
[self removeTrackingRect:trackingRect];
trackingRect = nil;
}
}
-(void)setFrame:(NSRect)frame
{
[super setFrame:frame];
[self updateTrackingRect];
}
-(void)setBounds:(NSRect)bounds
{
[super setBounds:bounds];

View File

@ -135,6 +135,8 @@
impl->width = content_rect.size.width;
impl->height = content_rect.size.height;
[[self contentView] setBounds:NSMakeRect (0, 0, impl->width, impl->height)];
/* Synthesize a configure event */
event = gdk_event_new (GDK_CONFIGURE);
event->configure.window = g_object_ref (window);