]): Listen to windowDidResignMain notifications and properly update the

2006-07-19  Richard Hult  <richard@imendio.com>

	* gdk/quartz/GdkQuartzWindow.c
	([GdkQuartzWindow -windowDidResignMain:]):
	* gdk/quartz/gdkevents-quartz.c (_gdk_quartz_update_focus_window):
	Listen to windowDidResignMain notifications and properly update the
	focus window when windows are unfocused.
This commit is contained in:
Richard Hult 2006-07-19 17:06:40 +00:00 committed by Richard Hult
parent e1d2805cc5
commit d3973cb865
5 changed files with 63 additions and 25 deletions

View File

@ -1,3 +1,11 @@
2006-07-19 Richard Hult <richard@imendio.com>
* gdk/quartz/GdkQuartzWindow.c
([GdkQuartzWindow -windowDidResignMain:]):
* gdk/quartz/gdkevents-quartz.c (_gdk_quartz_update_focus_window):
Listen to windowDidResignMain notifications and properly update the
focus window when windows are unfocused.
2006-07-19 Kristian Rietveld <kris@imendio.com>
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_init),

View File

@ -1,3 +1,11 @@
2006-07-19 Richard Hult <richard@imendio.com>
* gdk/quartz/GdkQuartzWindow.c
([GdkQuartzWindow -windowDidResignMain:]):
* gdk/quartz/gdkevents-quartz.c (_gdk_quartz_update_focus_window):
Listen to windowDidResignMain notifications and properly update the
focus window when windows are unfocused.
2006-07-19 Kristian Rietveld <kris@imendio.com>
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_init),

View File

@ -59,7 +59,14 @@
{
GdkWindow *window = [[self contentView] gdkWindow];
_gdk_quartz_update_focus_window (window);
_gdk_quartz_update_focus_window (window, TRUE);
}
-(void)windowDidResignMain:(NSNotification *)aNotification
{
GdkWindow *window = [[self contentView] gdkWindow];
_gdk_quartz_update_focus_window (window, FALSE);
}
-(void)windowDidMove:(NSNotification *)aNotification

View File

@ -748,24 +748,42 @@ create_focus_event (GdkWindow *window,
return event;
}
/* Note: Used to both set a new focus window and to unset the old one. */
void
_gdk_quartz_update_focus_window (GdkWindow *new_window)
_gdk_quartz_update_focus_window (GdkWindow *window,
gboolean got_focus)
{
GdkEvent *event;
if (got_focus && window == current_keyboard_window)
return;
/* FIXME: Don't do this when grabbed */
if (new_window != current_keyboard_window)
if (!got_focus)
{
GdkEvent *event;
if (window == current_keyboard_window)
{
event = create_focus_event (current_keyboard_window, FALSE);
append_event (event);
g_object_unref (current_keyboard_window);
current_keyboard_window = NULL;
}
}
event = create_focus_event (current_keyboard_window, FALSE);
if (got_focus)
{
if (current_keyboard_window)
{
event = create_focus_event (current_keyboard_window, FALSE);
append_event (event);
g_object_unref (current_keyboard_window);
current_keyboard_window = NULL;
}
event = create_focus_event (window, TRUE);
append_event (event);
event = create_focus_event (new_window, TRUE);
append_event (event);
g_object_unref (current_keyboard_window);
current_keyboard_window = g_object_ref (new_window);
current_keyboard_window = g_object_ref (window);
}
}
@ -1466,7 +1484,6 @@ gdk_event_translate (NSEvent *nsevent)
case NSRightMouseUp:
case NSOtherMouseUp:
event = create_button_event (window, nsevent, x, y);
append_event (event);
/* Ungrab implicit grab */
@ -1550,17 +1567,14 @@ gdk_event_translate (NSEvent *nsevent)
void
_gdk_events_queue (GdkDisplay *display)
{
if (current_event)
{
if (!gdk_event_translate (current_event))
{
[NSApp sendEvent:current_event];
}
[current_event release];
current_event = NULL;
}
if (current_event)
{
if (!gdk_event_translate (current_event))
[NSApp sendEvent:current_event];
[current_event release];
current_event = NULL;
}
}
void

View File

@ -103,7 +103,8 @@ void _gdk_quartz_set_context_stroke_color_from_pixel (CGContextRef context, GdkC
void _gdk_quartz_update_context_from_gc (CGContextRef context, GdkGC *gc);
void _gdk_quartz_update_focus_window (GdkWindow *new_window);
void _gdk_quartz_update_focus_window (GdkWindow *new_window,
gboolean got_focus);
gint _gdk_quartz_get_inverted_screen_y (gint y);