mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-05 16:20:10 +00:00
Don't create or update the tracking rect in the window, move it to the
2007-06-20 Richard Hult <richard@imendio.com> * gdk/quartz/gdkwindow-quartz.c (gdk_window_new): * gdk/quartz/GdkQuartzWindow.c (windowDidResize): Don't create or update the tracking rect in the window, move it to the view where it belongs. * gdk/quartz/GdkQuartzView.c (updateTrackingRect) (viewDidMoveToWindow, viewWillMoveToWindow) (setFrame, setBounds): Create and update the tracking rect here. svn path=/trunk/; revision=18197
This commit is contained in:
parent
708dba5dc6
commit
0932e4be38
11
ChangeLog
11
ChangeLog
@ -1,3 +1,14 @@
|
||||
2007-06-20 Richard Hult <richard@imendio.com>
|
||||
|
||||
* gdk/quartz/gdkwindow-quartz.c (gdk_window_new):
|
||||
* gdk/quartz/GdkQuartzWindow.c (windowDidResize): Don't create or
|
||||
update the tracking rect in the window, move it to the view where
|
||||
it belongs.
|
||||
|
||||
* gdk/quartz/GdkQuartzView.c (updateTrackingRect)
|
||||
(viewDidMoveToWindow, viewWillMoveToWindow)
|
||||
(setFrame, setBounds): Create and update the tracking rect here.
|
||||
|
||||
2007-06-19 Mathias Hasselmann <mathias.hasselmann@gmx.de>
|
||||
|
||||
* gdk/gdkinternals.h: Restore G_BEGIN_DECLS at the
|
||||
|
@ -110,4 +110,56 @@
|
||||
GDK_QUARTZ_RELEASE_POOL;
|
||||
}
|
||||
|
||||
/* For information on seting up tracking rects properly, see here:
|
||||
* http://developer.apple.com/documentation/Cocoa/Conceptual/EventOverview/EventOverview.pdf
|
||||
*/
|
||||
-(void)updateTrackingRect
|
||||
{
|
||||
GdkWindowObject *private = GDK_WINDOW_OBJECT (gdk_window);
|
||||
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
|
||||
|
||||
if (trackingRect)
|
||||
{
|
||||
[self removeTrackingRect:trackingRect];
|
||||
trackingRect = nil;
|
||||
}
|
||||
|
||||
if (!impl->toplevel)
|
||||
return;
|
||||
|
||||
trackingRect = [self addTrackingRect:[self bounds]
|
||||
owner:self
|
||||
userData:nil
|
||||
assumeInside:NO];
|
||||
}
|
||||
|
||||
-(void)viewDidMoveToWindow
|
||||
{
|
||||
if (![self window]) /* We are destroyed already */
|
||||
return;
|
||||
|
||||
[self updateTrackingRect];
|
||||
}
|
||||
|
||||
-(void)viewWillMoveToWindow:(NSWindow *)newWindow
|
||||
{
|
||||
if ([self window] && trackingRect)
|
||||
{
|
||||
[self removeTrackingRect:trackingRect];
|
||||
trackingRect = nil;
|
||||
}
|
||||
}
|
||||
|
||||
-(void)setFrame:(NSRect)frame
|
||||
{
|
||||
[super setFrame:frame];
|
||||
[self updateTrackingRect];
|
||||
}
|
||||
|
||||
-(void)setBounds:(NSRect)bounds
|
||||
{
|
||||
[super setBounds:bounds];
|
||||
[self updateTrackingRect];
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
@interface GdkQuartzView : NSView {
|
||||
GdkWindow *gdk_window;
|
||||
NSTrackingRectTag trackingRect;
|
||||
}
|
||||
|
||||
-(void)setGdkWindow:(GdkWindow *)window;
|
||||
|
@ -136,7 +136,6 @@
|
||||
impl->height = content_rect.size.height;
|
||||
|
||||
/* Synthesize a configure event */
|
||||
|
||||
event = gdk_event_new (GDK_CONFIGURE);
|
||||
event->configure.window = g_object_ref (window);
|
||||
event->configure.x = private->x;
|
||||
@ -145,13 +144,6 @@
|
||||
event->configure.height = impl->height;
|
||||
|
||||
_gdk_event_queue_append (gdk_display_get_default (), event);
|
||||
|
||||
/* Update tracking rectangle */
|
||||
[[self contentView] removeTrackingRect:impl->tracking_rect];
|
||||
impl->tracking_rect = [impl->view addTrackingRect:NSMakeRect(0, 0, impl->width, impl->height)
|
||||
owner:impl->view
|
||||
userData:nil
|
||||
assumeInside:NO];
|
||||
}
|
||||
|
||||
-(id)initWithContentRect:(NSRect)contentRect styleMask:(unsigned int)styleMask backing:(NSBackingStoreType)backingType defer:(BOOL)flag
|
||||
@ -161,12 +153,7 @@
|
||||
backing:backingType
|
||||
defer:flag];
|
||||
|
||||
|
||||
/* A possible modification here would be to only accept mouse moved events
|
||||
* if any of the child GdkWindows are interested in mouse moved events.
|
||||
*/
|
||||
[self setAcceptsMouseMovedEvents:YES];
|
||||
|
||||
[self setDelegate:self];
|
||||
[self setReleasedWhenClosed:YES];
|
||||
|
||||
|
@ -643,16 +643,17 @@ gdk_window_new (GdkWindow *parent,
|
||||
const char *title;
|
||||
int style_mask;
|
||||
|
||||
switch (attributes->window_type) {
|
||||
case GDK_WINDOW_TEMP:
|
||||
style_mask = NSBorderlessWindowMask;
|
||||
break;
|
||||
default:
|
||||
style_mask = (NSTitledWindowMask |
|
||||
NSClosableWindowMask |
|
||||
NSMiniaturizableWindowMask |
|
||||
NSResizableWindowMask);
|
||||
}
|
||||
switch (attributes->window_type)
|
||||
{
|
||||
case GDK_WINDOW_TEMP:
|
||||
style_mask = NSBorderlessWindowMask;
|
||||
break;
|
||||
default:
|
||||
style_mask = (NSTitledWindowMask |
|
||||
NSClosableWindowMask |
|
||||
NSMiniaturizableWindowMask |
|
||||
NSResizableWindowMask);
|
||||
}
|
||||
|
||||
impl->toplevel = [[GdkQuartzWindow alloc] initWithContentRect:content_rect
|
||||
styleMask:style_mask
|
||||
@ -665,7 +666,7 @@ gdk_window_new (GdkWindow *parent,
|
||||
title = get_default_title ();
|
||||
|
||||
gdk_window_set_title (window, title);
|
||||
|
||||
|
||||
if (draw_impl->colormap == gdk_screen_get_rgba_colormap (_gdk_screen))
|
||||
{
|
||||
[impl->toplevel setOpaque:NO];
|
||||
@ -675,14 +676,9 @@ gdk_window_new (GdkWindow *parent,
|
||||
impl->view = [[GdkQuartzView alloc] initWithFrame:content_rect];
|
||||
[impl->view setGdkWindow:window];
|
||||
[impl->toplevel setContentView:impl->view];
|
||||
|
||||
/* Add a tracking rect */
|
||||
impl->tracking_rect = [impl->view addTrackingRect:NSMakeRect(0, 0, impl->width, impl->height)
|
||||
owner:impl->view
|
||||
userData:nil
|
||||
assumeInside:NO];
|
||||
}
|
||||
break;
|
||||
|
||||
case GDK_WINDOW_CHILD:
|
||||
{
|
||||
GdkWindowImplQuartz *parent_impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (parent)->impl);
|
||||
@ -701,6 +697,7 @@ gdk_window_new (GdkWindow *parent,
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user