Add GDK button mask for NS dragging events. (create_scroll_event): Remove

2006-08-15  Richard Hult  <richard@imendio.com>

	* gdk/quartz/gdkevents-quartz.c: (get_event_mask_from_ns_event):
	Add GDK button mask for NS dragging events.
	(create_scroll_event): Remove obsolete comment.
	(_gdk_quartz_get_current_event_mask), (gdk_event_translate): Keep
	track of the latest event mask here...

	* gdk/quartz/gdkwindow-quartz.c:
	(_gdk_windowing_window_get_pointer): And use it here. Patch from
	Kristian Rietveld.
	(gdk_window_quartz_update_idle): Rename to make things clearer.
This commit is contained in:
Richard Hult 2006-08-15 20:13:13 +00:00 committed by Richard Hult
parent 895e9b3584
commit 382ef872b4
5 changed files with 50 additions and 13 deletions

View File

@ -1,3 +1,16 @@
2006-08-15 Richard Hult <richard@imendio.com>
* gdk/quartz/gdkevents-quartz.c: (get_event_mask_from_ns_event):
Add GDK button mask for NS dragging events.
(create_scroll_event): Remove obsolete comment.
(_gdk_quartz_get_current_event_mask), (gdk_event_translate): Keep
track of the latest event mask here...
* gdk/quartz/gdkwindow-quartz.c:
(_gdk_windowing_window_get_pointer): And use it here. Patch from
Kristian Rietveld.
(gdk_window_quartz_update_idle): Rename to make things clearer.
2006-08-15 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkprintoperationpreview.c:

View File

@ -1,3 +1,16 @@
2006-08-15 Richard Hult <richard@imendio.com>
* gdk/quartz/gdkevents-quartz.c: (get_event_mask_from_ns_event):
Add GDK button mask for NS dragging events.
(create_scroll_event): Remove obsolete comment.
(_gdk_quartz_get_current_event_mask), (gdk_event_translate): Keep
track of the latest event mask here...
* gdk/quartz/gdkwindow-quartz.c:
(_gdk_windowing_window_get_pointer): And use it here. Patch from
Kristian Rietveld.
(gdk_window_quartz_update_idle): Rename to make things clearer.
2006-08-15 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkprintoperationpreview.c:

View File

@ -637,11 +637,13 @@ get_event_mask_from_ns_event (NSEvent *nsevent)
*/
return GDK_SCROLL_MASK | GDK_BUTTON_PRESS_MASK;
case NSLeftMouseDragged:
return GDK_POINTER_MOTION_MASK|GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_MOTION_MASK|GDK_BUTTON1_MOTION_MASK;
return (GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_MOTION_MASK | GDK_BUTTON1_MOTION_MASK |
GDK_BUTTON1_MASK);
case NSRightMouseDragged:
return GDK_POINTER_MOTION_MASK|GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_MOTION_MASK|GDK_BUTTON3_MOTION_MASK;
return (GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_MOTION_MASK | GDK_BUTTON3_MOTION_MASK |
GDK_BUTTON3_MASK);
case NSOtherMouseDragged:
{
GdkEventMask mask;
@ -651,7 +653,8 @@ get_event_mask_from_ns_event (NSEvent *nsevent)
GDK_BUTTON_MOTION_MASK);
if (convert_mouse_button_number ([nsevent buttonNumber]) == 2)
mask |= GDK_BUTTON2_MOTION_MASK;
mask |= (GDK_BUTTON2_MOTION_MASK | GDK_BUTTON2_MOTION_MASK |
GDK_BUTTON2_MASK);
return mask;
}
@ -756,7 +759,7 @@ get_keyboard_modifiers_from_nsevent (NSEvent *nsevent)
modifiers |= GDK_CONTROL_MASK;
if (nsflags & NSCommandKeyMask)
modifiers |= GDK_MOD1_MASK;
/* FIXME: Support GDK_BUTTON_MASK */
return modifiers;
@ -1297,8 +1300,6 @@ create_scroll_event (GdkWindow *window, NSEvent *nsevent, GdkScrollDirection dir
&event->scroll.x_root,
&event->scroll.y_root);
/* FIXME event->state; */
/* FIXME event->is_hint; */
event->scroll.direction = direction;
event->scroll.device = _gdk_display->core_pointer;
@ -1377,6 +1378,12 @@ create_key_event (GdkWindow *window, NSEvent *nsevent, GdkEventType type)
return event;
}
static GdkEventMask current_mask = 0;
GdkEventMask _gdk_quartz_get_current_event_mask (void)
{
return current_mask;
}
static gboolean
gdk_event_translate (NSEvent *nsevent)
{
@ -1438,7 +1445,9 @@ gdk_event_translate (NSEvent *nsevent)
if (result == GDK_FILTER_REMOVE)
return TRUE;
current_mask = get_event_mask_from_ns_event (nsevent);
switch ([nsevent type])
{
case NSLeftMouseDown:

View File

@ -131,6 +131,8 @@ void _gdk_quartz_send_map_events (GdkWindow *window);
GdkEventType _gdk_quartz_key_event_type (NSEvent *event);
gboolean _gdk_quartz_key_is_modifier (guint keycode);
GdkEventMask _gdk_quartz_get_current_event_mask (void);
extern GdkWindow *_gdk_quartz_keyboard_grab_window;
extern GdkWindow *_gdk_quartz_pointer_grab_window;

View File

@ -289,7 +289,7 @@ gdk_window_quartz_process_all_updates (void)
}
static gboolean
gdk_window_update_idle (gpointer data)
gdk_window_quartz_update_idle (gpointer data)
{
GDK_THREADS_ENTER ();
gdk_window_quartz_process_all_updates ();
@ -325,7 +325,7 @@ gdk_window_impl_quartz_invalidate_maybe_recurse (GdkPaintable *paintable,
if (update_idle == 0)
update_idle = g_idle_add_full (GDK_PRIORITY_REDRAW,
gdk_window_update_idle, NULL, NULL);
gdk_window_quartz_update_idle, NULL, NULL);
}
}
@ -1222,12 +1222,14 @@ _gdk_windowing_window_get_pointer (GdkDisplay *display,
{
point = [NSEvent mouseLocation];
y_tmp = _gdk_quartz_get_inverted_screen_y (point.y);
*mask = _gdk_quartz_get_current_event_mask ();
}
else
{
NSWindow *nswindow = impl->toplevel;
point = [nswindow mouseLocationOutsideOfEventStream];
y_tmp = impl->height - point.y;
*mask = _gdk_quartz_get_current_event_mask ();
}
x_tmp = point.x;
@ -1239,10 +1241,8 @@ _gdk_windowing_window_get_pointer (GdkDisplay *display,
private = private->parent;
}
/* FIXME: Implement mask. */
*x = x_tmp;
*y = y_tmp;
*mask = 0;
return _gdk_quartz_find_child_window_by_point (window,
point.x, point.y,