Commit 1abf7df6 authored by Owen Taylor's avatar Owen Taylor Committed by Owen Taylor

Make the core pointer object per-display. (#85698)

Tue Jun 18 19:11:51 2002  Owen Taylor  <otaylor@redhat.com>

        * gdk/gdkdisplay.[ch] gdk/gdkevents.c gdk/gdkinput.h
        gdk/gdkinternals.h gdk/win32/gdkevents-win32.c
        gdk/win32/gdkinput-win32.[ch] gdk/x11/gdkevents-x11.c
        gdk/x11/gdkinput{,-none,-x11}.c gdk/x11/gdkinputprivate.h:
        Make the core pointer object per-display. (#85698)
parent c597a7be
Tue Jun 18 19:11:51 2002 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdisplay.[ch] gdk/gdkevents.c gdk/gdkinput.h
gdk/gdkinternals.h gdk/win32/gdkevents-win32.c
gdk/win32/gdkinput-win32.[ch] gdk/x11/gdkevents-x11.c
gdk/x11/gdkinput{,-none,-x11}.c gdk/x11/gdkinputprivate.h:
Make the core pointer object per-display. (#85698)
* gtk/gtkdnd.c gtk/gtktreeview.c: Adapt to above change.
2002-06-18 Yanko Kaneti <yaneti@declera.com>
* configure.in: (ALL_LINGUAS) Added Bulgarian (bg).
......
Tue Jun 18 19:11:51 2002 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdisplay.[ch] gdk/gdkevents.c gdk/gdkinput.h
gdk/gdkinternals.h gdk/win32/gdkevents-win32.c
gdk/win32/gdkinput-win32.[ch] gdk/x11/gdkevents-x11.c
gdk/x11/gdkinput{,-none,-x11}.c gdk/x11/gdkinputprivate.h:
Make the core pointer object per-display. (#85698)
* gtk/gtkdnd.c gtk/gtktreeview.c: Adapt to above change.
2002-06-18 Yanko Kaneti <yaneti@declera.com>
* configure.in: (ALL_LINGUAS) Added Bulgarian (bg).
......
Tue Jun 18 19:11:51 2002 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdisplay.[ch] gdk/gdkevents.c gdk/gdkinput.h
gdk/gdkinternals.h gdk/win32/gdkevents-win32.c
gdk/win32/gdkinput-win32.[ch] gdk/x11/gdkevents-x11.c
gdk/x11/gdkinput{,-none,-x11}.c gdk/x11/gdkinputprivate.h:
Make the core pointer object per-display. (#85698)
* gtk/gtkdnd.c gtk/gtktreeview.c: Adapt to above change.
2002-06-18 Yanko Kaneti <yaneti@declera.com>
* configure.in: (ALL_LINGUAS) Added Bulgarian (bg).
......
Tue Jun 18 19:11:51 2002 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdisplay.[ch] gdk/gdkevents.c gdk/gdkinput.h
gdk/gdkinternals.h gdk/win32/gdkevents-win32.c
gdk/win32/gdkinput-win32.[ch] gdk/x11/gdkevents-x11.c
gdk/x11/gdkinput{,-none,-x11}.c gdk/x11/gdkinputprivate.h:
Make the core pointer object per-display. (#85698)
* gtk/gtkdnd.c gtk/gtktreeview.c: Adapt to above change.
2002-06-18 Yanko Kaneti <yaneti@declera.com>
* configure.in: (ALL_LINGUAS) Added Bulgarian (bg).
......
Tue Jun 18 19:11:51 2002 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdisplay.[ch] gdk/gdkevents.c gdk/gdkinput.h
gdk/gdkinternals.h gdk/win32/gdkevents-win32.c
gdk/win32/gdkinput-win32.[ch] gdk/x11/gdkevents-x11.c
gdk/x11/gdkinput{,-none,-x11}.c gdk/x11/gdkinputprivate.h:
Make the core pointer object per-display. (#85698)
* gtk/gtkdnd.c gtk/gtktreeview.c: Adapt to above change.
2002-06-18 Yanko Kaneti <yaneti@declera.com>
* configure.in: (ALL_LINGUAS) Added Bulgarian (bg).
......
Tue Jun 18 19:11:51 2002 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdisplay.[ch] gdk/gdkevents.c gdk/gdkinput.h
gdk/gdkinternals.h gdk/win32/gdkevents-win32.c
gdk/win32/gdkinput-win32.[ch] gdk/x11/gdkevents-x11.c
gdk/x11/gdkinput{,-none,-x11}.c gdk/x11/gdkinputprivate.h:
Make the core pointer object per-display. (#85698)
* gtk/gtkdnd.c gtk/gtktreeview.c: Adapt to above change.
2002-06-18 Yanko Kaneti <yaneti@declera.com>
* configure.in: (ALL_LINGUAS) Added Bulgarian (bg).
......
......@@ -224,11 +224,9 @@ Specifies how an axis of a device is used.
<!-- ##### FUNCTION gdk_device_get_core_pointer ##### -->
<para>
Returns the device for the core pointer. The device is statically
allocated and should not be freed.
</para>
@Returns: a #GdkDevice.
@Returns:
<!-- ##### FUNCTION gdk_device_get_state ##### -->
......
......@@ -323,3 +323,31 @@ gdk_event_send_clientmessage_toall (GdkEvent *event)
gdk_screen_broadcast_client_message (gdk_get_default_screen (), event);
}
/**
* gdk_device_get_core_pointer:
*
* Returns the core pointer device for the default display.
*
* Return value: the core pointer device; this is owned by the
* display and should not be freed.
**/
GdkDevice *
gdk_device_get_core_pointer (void)
{
return gdk_display_get_core_pointer (gdk_get_default_display ());
}
/**
* gdk_display_get_core_pointer:
* @display: a #GdkDisplay
*
* Returns the core pointer device for the given display
*
* Return value: the core pointer device; this is owned by the
* display and should not be freed.
**/
GdkDevice *
gdk_display_get_core_pointer (GdkDisplay *display)
{
return display->core_pointer;
}
......@@ -55,6 +55,8 @@ struct _GdkDisplay
GdkWindow *button_window[2]; /* The last 2 windows to receive button presses. */
guint button_number[2]; /* The last 2 buttons to be pressed. */
GdkDevice *core_pointer; /* Core pointer device */
guint double_click_time; /* Maximum time between clicks in msecs */
};
......@@ -107,6 +109,8 @@ void gdk_display_set_sm_client_id (GdkDisplay *display,
void gdk_set_default_display (GdkDisplay *display);
GdkDisplay *gdk_get_default_display (void);
GdkDevice *gdk_display_get_core_pointer (GdkDisplay *display);
G_END_DECLS
#endif /* __GDK_DISPLAY_H__ */
......@@ -1019,12 +1019,6 @@ gdk_event_get_type (void)
return our_type;
}
GdkDevice *
gdk_device_get_core_pointer (void)
{
return _gdk_core_pointer;
}
/**
* gdk_setting_get:
* @name: the name of the setting.
......
......@@ -138,7 +138,9 @@ void gdk_input_set_extension_events (GdkWindow *window,
gint mask,
GdkExtensionMode mode);
#ifndef GDK_MULTIHEAD_SAFE
GdkDevice *gdk_device_get_core_pointer (void);
#endif
#ifdef __cplusplus
}
......
......@@ -147,8 +147,6 @@ extern GdkEventFunc _gdk_event_func; /* Callback for events */
extern gpointer _gdk_event_data;
extern GDestroyNotify _gdk_event_notify;
extern GdkDevice *_gdk_core_pointer;
extern GSList *_gdk_displays;
extern gchar *_gdk_display_name;
......
......@@ -2001,7 +2001,7 @@ gdk_event_translate (GdkDisplay *display,
event->scroll.x_root = (gint16) LOWORD (msg->lParam);
event->scroll.y_root = (gint16) HIWORD (msg->lParam);
event->scroll.state = 0; /* No state information with MSH_MOUSEWHEEL */
event->scroll.device = _gdk_core_pointer;
event->scroll.device = display->core_pointer;
return_val = !GDK_WINDOW_DESTROYED (window);
goto done;
......@@ -2520,7 +2520,7 @@ gdk_event_translate (GdkDisplay *display,
event->button.axes = NULL;
event->button.state = build_pointer_event_state (msg);
event->button.button = button;
event->button.device = _gdk_core_pointer;
event->button.device = display->core_pointer;
_gdk_event_button_generate (display, event);
......@@ -2577,7 +2577,7 @@ gdk_event_translate (GdkDisplay *display,
event->button.axes = NULL;
event->button.state = build_pointer_event_state (msg);
event->button.button = button;
event->button.device = _gdk_core_pointer;
event->button.device = display->core_pointer;
return_val = !GDK_WINDOW_DESTROYED (window);
}
......@@ -2642,7 +2642,7 @@ gdk_event_translate (GdkDisplay *display,
event->motion.axes = NULL;
event->motion.state = build_pointer_event_state (msg);
event->motion.is_hint = FALSE;
event->motion.device = _gdk_core_pointer;
event->motion.device = display->core_pointer;
return_val = !GDK_WINDOW_DESTROYED (window);
break;
......@@ -2736,7 +2736,7 @@ gdk_event_translate (GdkDisplay *display,
event->scroll.x_root = (gint16) LOWORD (msg->lParam);
event->scroll.y_root = (gint16) HIWORD (msg->lParam);
event->scroll.state = build_pointer_event_state (msg);
event->scroll.device = _gdk_core_pointer;
event->scroll.device = display->core_pointer;
return_val = !GDK_WINDOW_DESTROYED (window);
break;
......
......@@ -1208,6 +1208,6 @@ _gdk_input_init (void)
gdk_input_wintab_init ();
#endif /* HAVE_WINTAB */
_gdk_input_devices = g_list_append (_gdk_input_devices, _gdk_core_pointer);
_gdk_input_devices = g_list_append (_gdk_input_devices, display->core_pointer);
}
......@@ -121,7 +121,7 @@ struct _GdkInputWindow
/* Global data */
#define GDK_IS_CORE(d) (((GdkDevice *)(d)) == _gdk_core_pointer)
#define GDK_IS_CORE(d) (((GdkDevice *)(d)) == gdk_get_default_display ()->core_pointer)
extern GList *_gdk_input_devices;
extern GList *_gdk_input_windows;
......
......@@ -54,8 +54,6 @@ static GdkDeviceAxis gdk_input_core_axes[] = {
/* Global variables */
GDKVAR GdkDevice *_gdk_core_pointer = NULL;
gint _gdk_input_ignore_core;
GList *_gdk_input_devices;
......@@ -64,16 +62,16 @@ GList *_gdk_input_windows;
void
_gdk_init_input_core (void)
{
_gdk_core_pointer = g_object_new (GDK_TYPE_DEVICE, NULL);
display->core_pointer = g_object_new (GDK_TYPE_DEVICE, NULL);
_gdk_core_pointer->name = "Core Pointer";
_gdk_core_pointer->source = GDK_SOURCE_MOUSE;
_gdk_core_pointer->mode = GDK_MODE_SCREEN;
_gdk_core_pointer->has_cursor = TRUE;
_gdk_core_pointer->num_axes = 2;
_gdk_core_pointer->axes = gdk_input_core_axes;
_gdk_core_pointer->num_keys = 0;
_gdk_core_pointer->keys = NULL;
display->core_pointer->name = "Core Pointer";
display->core_pointer->source = GDK_SOURCE_MOUSE;
display->core_pointer->mode = GDK_MODE_SCREEN;
display->core_pointer->has_cursor = TRUE;
display->core_pointer->num_axes = 2;
display->core_pointer->axes = gdk_input_core_axes;
display->core_pointer->num_keys = 0;
display->core_pointer->keys = NULL;
}
static void
......
......@@ -794,7 +794,7 @@ gdk_event_translate (GdkDisplay *display,
event->scroll.x_root = (gfloat)xevent->xbutton.x_root;
event->scroll.y_root = (gfloat)xevent->xbutton.y_root;
event->scroll.state = (GdkModifierType) xevent->xbutton.state;
event->scroll.device = _gdk_core_pointer;
event->scroll.device = display->core_pointer;
break;
default:
......@@ -808,7 +808,7 @@ gdk_event_translate (GdkDisplay *display,
event->button.axes = NULL;
event->button.state = (GdkModifierType) xevent->xbutton.state;
event->button.button = xevent->xbutton.button;
event->button.device = _gdk_core_pointer;
event->button.device = display->core_pointer;
_gdk_event_button_generate (display, event);
break;
......@@ -849,7 +849,7 @@ gdk_event_translate (GdkDisplay *display,
event->button.axes = NULL;
event->button.state = (GdkModifierType) xevent->xbutton.state;
event->button.button = xevent->xbutton.button;
event->button.device = _gdk_core_pointer;
event->button.device = display->core_pointer;
break;
......@@ -878,7 +878,7 @@ gdk_event_translate (GdkDisplay *display,
event->motion.axes = NULL;
event->motion.state = (GdkModifierType) xevent->xmotion.state;
event->motion.is_hint = xevent->xmotion.is_hint;
event->motion.device = _gdk_core_pointer;
event->motion.device = display->core_pointer;
break;
......
......@@ -32,9 +32,9 @@ _gdk_input_init (GdkDisplay *display)
{
GdkDisplayX11 *display_x11 = GDK_DISPLAY_X11 (display);
_gdk_init_input_core ();
_gdk_init_input_core (display);
display_x11->input_devices = g_list_append (NULL, _gdk_core_pointer);
display_x11->input_devices = g_list_append (NULL, display->core_pointer);
display_x11->input_ignore_core = FALSE;
}
......
......@@ -412,7 +412,7 @@ gdk_input_common_init (GdkDisplay *display,
XFreeDeviceList(devices);
}
display_x11->input_devices = g_list_append (display_x11->input_devices, _gdk_core_pointer);
display_x11->input_devices = g_list_append (display_x11->input_devices, display->core_pointer);
return TRUE;
}
......
......@@ -41,21 +41,19 @@ static GdkDeviceAxis gdk_input_core_axes[] = {
{ GDK_AXIS_Y, 0, 0 }
};
GdkDevice *_gdk_core_pointer = NULL;
void
_gdk_init_input_core (void)
_gdk_init_input_core (GdkDisplay *display)
{
_gdk_core_pointer = g_object_new (GDK_TYPE_DEVICE, NULL);
display->core_pointer = g_object_new (GDK_TYPE_DEVICE, NULL);
_gdk_core_pointer->name = "Core Pointer";
_gdk_core_pointer->source = GDK_SOURCE_MOUSE;
_gdk_core_pointer->mode = GDK_MODE_SCREEN;
_gdk_core_pointer->has_cursor = TRUE;
_gdk_core_pointer->num_axes = 2;
_gdk_core_pointer->axes = gdk_input_core_axes;
_gdk_core_pointer->num_keys = 0;
_gdk_core_pointer->keys = NULL;
display->core_pointer->name = "Core Pointer";
display->core_pointer->source = GDK_SOURCE_MOUSE;
display->core_pointer->mode = GDK_MODE_SCREEN;
display->core_pointer->has_cursor = TRUE;
display->core_pointer->num_axes = 2;
display->core_pointer->axes = gdk_input_core_axes;
display->core_pointer->num_keys = 0;
display->core_pointer->keys = NULL;
}
GType
......
......@@ -126,7 +126,7 @@ struct _GdkInputWindow
/* Global data */
#define GDK_IS_CORE(d) (((GdkDevice *)(d)) == _gdk_core_pointer)
#define GDK_IS_CORE(d) (((GdkDevice *)(d)) == ((GdkDevicePrivate *)(d))->display->core_pointer)
/* Function declarations */
......@@ -134,7 +134,7 @@ GdkInputWindow *gdk_input_window_find (GdkWindow *window);
void gdk_input_window_destroy (GdkWindow *window);
GdkTimeCoord ** _gdk_device_allocate_history (GdkDevice *device,
gint n_events);
void _gdk_init_input_core (void);
void _gdk_init_input_core (GdkDisplay *display);
/* The following functions are provided by each implementation
* (xfree, gxi, and none)
......
......@@ -3059,7 +3059,7 @@ gtk_drag_end (GtkDragSourceInfo *info, guint32 time)
send_event.button.axes = NULL;
send_event.button.state = 0;
send_event.button.button = info->button;
send_event.button.device = gdk_device_get_core_pointer ();
send_event.button.device = gdk_display_get_core_pointer (display);
send_event.button.x_root = 0;
send_event.button.y_root = 0;
......
......@@ -6795,6 +6795,7 @@ _gtk_tree_view_column_start_drag (GtkTreeView *tree_view,
GtkAllocation allocation;
gint x, y, width, height;
GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (tree_view));
GdkDisplay *display = gtk_screen_get_display (screen);
g_return_if_fail (tree_view->priv->column_drag_info == NULL);
......@@ -6821,8 +6822,8 @@ _gtk_tree_view_column_start_drag (GtkTreeView *tree_view,
gdk_window_set_user_data (tree_view->priv->drag_window, GTK_WIDGET (tree_view));
}
gdk_display_pointer_ungrab (gdk_screen_get_display (screen), GDK_CURRENT_TIME);
gdk_display_keyboard_ungrab (gdk_screen_get_display (screen), GDK_CURRENT_TIME);
gdk_display_pointer_ungrab (display, GDK_CURRENT_TIME);
gdk_display_keyboard_ungrab (display, GDK_CURRENT_TIME);
gtk_grab_remove (column->button);
......@@ -6844,7 +6845,7 @@ _gtk_tree_view_column_start_drag (GtkTreeView *tree_view,
send_event.button.axes = NULL;
send_event.button.state = 0;
send_event.button.button = 1;
send_event.button.device = gdk_device_get_core_pointer ();
send_event.button.device = gdk_display_get_core_pointer (display);
send_event.button.x_root = 0;
send_event.button.y_root = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment