Commit 2c8c1c6d authored by Carlos Garnacho's avatar Carlos Garnacho

Remove *_set_extension_events() and old API to query devices.

The old functions to get core pointer and devices list are gone as
well. This slice is entirely replaced internally by multidevice
handling and may just go.
parent 23c1d1cb
......@@ -122,7 +122,6 @@ gdk_display_sync
gdk_display_flush
gdk_display_close
gdk_display_is_closed
gdk_display_list_devices
gdk_display_get_event
gdk_display_peek_event
gdk_display_put_event
......@@ -173,7 +172,6 @@ gdk_display_manager_get
gdk_display_manager_get_default_display
gdk_display_manager_set_default_display
gdk_display_manager_list_displays
gdk_display_get_core_pointer
<SUBSECTION Standard>
GDK_DISPLAY_MANAGER
GDK_DISPLAY_MANAGER_CLASS
......@@ -738,14 +736,6 @@ gdk_device_get_axis
gdk_device_list_axes
gdk_device_get_axis_value
<SUBSECTION>
gdk_input_set_extension_events
GdkExtensionMode
<SUBSECTION>
gdk_devices_list
gdk_device_get_core_pointer
<SUBSECTION Standard>
GDK_TYPE_AXIS_USE
GDK_TYPE_EXTENSION_MODE
......
......@@ -4937,8 +4937,6 @@ gtk_widget_get_parent_window
gtk_widget_set_events
gtk_widget_get_events
gtk_widget_add_events
gtk_widget_set_extension_events
gtk_widget_get_extension_events
gtk_widget_set_device_events
gtk_widget_get_device_events
gtk_widget_add_device_events
......
......@@ -72,7 +72,6 @@ gdk_public_h_sources = \
gdkdisplaymanager.h \
gdkdnd.h \
gdkevents.h \
gdkinput.h \
gdkkeys.h \
gdkkeysyms.h \
gdkkeysyms-compat.h \
......@@ -195,7 +194,6 @@ x11_introspection_files = \
x11/gdkgeometry-x11.c \
x11/gdkglobals-x11.c \
x11/gdkim-x11.c \
x11/gdkinput.c \
x11/gdkkeys-x11.c \
x11/gdkmain-x11.c \
x11/gdkproperty-x11.c \
......
......@@ -40,7 +40,6 @@
#include <gdk/gdkdnd.h>
#include <gdk/gdkenumtypes.h>
#include <gdk/gdkevents.h>
#include <gdk/gdkinput.h>
#include <gdk/gdkkeys.h>
#include <gdk/gdkkeysyms.h>
#include <gdk/gdkmain.h>
......
......@@ -50,7 +50,6 @@ gdk_device_get_associated_device
gdk_device_get_axis
gdk_device_get_axis_use
gdk_device_get_axis_value
gdk_device_get_core_pointer
gdk_device_get_device_type
gdk_device_get_display
gdk_device_get_has_cursor
......@@ -77,7 +76,6 @@ gdk_device_set_axis_use
gdk_device_set_key
gdk_device_set_mode
gdk_device_set_source
gdk_devices_list
gdk_device_type_get_type G_GNUC_CONST
gdk_device_ungrab
gdk_disable_multidevice
......@@ -86,7 +84,6 @@ gdk_display_beep
gdk_display_close
gdk_display_device_is_grabbed
gdk_display_flush
gdk_display_get_core_pointer
gdk_display_get_default
gdk_display_get_default_cursor_size
gdk_display_get_default_group
......@@ -104,7 +101,6 @@ gdk_display_get_window_at_device_position
gdk_display_get_window_at_pointer
gdk_display_is_closed
gdk_display_keyboard_ungrab
gdk_display_list_devices
gdk_display_manager_get
gdk_display_manager_get_default_display
gdk_display_manager_get_type G_GNUC_CONST
......@@ -208,7 +204,6 @@ gdk_gravity_get_type G_GNUC_CONST
gdk_init
gdk_init_check
gdk_input_mode_get_type G_GNUC_CONST
gdk_input_set_extension_events
gdk_input_source_get_type G_GNUC_CONST
gdk_keyboard_grab
gdk_keyboard_ungrab
......
......@@ -621,14 +621,9 @@ gdk_device_set_mode (GdkDevice *device,
gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_MASTER)
return FALSE;
/* FIXME: setting has_cursor when mode is window? */
device->priv->mode = mode;
g_object_notify (G_OBJECT (device), "input-mode");
if (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_MASTER)
_gdk_input_check_extension_events (device);
return TRUE;
}
......
......@@ -123,8 +123,6 @@ gboolean _gdk_device_translate_axis (GdkDevice *device,
GdkTimeCoord ** _gdk_device_allocate_history (GdkDevice *device,
gint n_events);
void _gdk_input_check_extension_events (GdkDevice *device);
void _gdk_device_add_slave (GdkDevice *device,
GdkDevice *slave);
void _gdk_device_remove_slave (GdkDevice *device,
......
......@@ -649,45 +649,6 @@ gdk_event_send_clientmessage_toall (GdkEvent *event)
gdk_screen_broadcast_client_message (gdk_screen_get_default (), event);
}
/**
* gdk_device_get_core_pointer:
*
* Returns the core pointer device for the default display.
*
* Return value: (transfer none): the core pointer device; this is owned
* by the display and should not be freed.
*
* Deprecated: 3.0: Use gdk_device_manager_get_client_pointer() instead, or
* gdk_event_get_device() if a #GdkEvent with pointer device
* information is available.
**/
GdkDevice *
gdk_device_get_core_pointer (void)
{
return gdk_display_get_core_pointer (gdk_display_get_default ());
}
/**
* gdk_display_get_core_pointer:
* @display: a #GdkDisplay
*
* Returns the core pointer device for the given display
*
* Return value: (transfer none): the core pointer device; this is owned by the
* display and should not be freed.
*
* Since: 2.2
*
* Deprecated: 3.0: Use gdk_device_manager_get_client_pointer() instead, or
* gdk_event_get_device() if a #GdkEvent with device
* information is available.
**/
GdkDevice *
gdk_display_get_core_pointer (GdkDisplay *display)
{
return display->core_pointer;
}
/**
* gdk_set_sm_client_id:
* @sm_client_id: the client id assigned by the session manager when the
......
......@@ -259,10 +259,6 @@ GdkDisplay *gdk_display_get_default (void);
#ifndef GDK_MULTIDEVICE_SAFE
#ifndef GDK_DISABLE_DEPRECATED
GdkDevice *gdk_display_get_core_pointer (GdkDisplay *display);
#endif /* GDK_DISABLE_DEPRECATED */
void gdk_display_get_pointer (GdkDisplay *display,
GdkScreen **screen,
gint *x,
......
/* GDK - The GIMP Drawing Kit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdk.h> can be included directly."
#endif
#ifndef __GDK_INPUT_H__
#define __GDK_INPUT_H__
#include <gdk/gdktypes.h>
#include <gdk/gdkdevice.h>
G_BEGIN_DECLS
#if !defined (GDK_MULTIDEVICE_SAFE) && !defined (GDK_DISABLE_DEPRECATED)
#ifndef GDK_MULTIHEAD_SAFE
/* Returns a list of GdkDevice * */
GList * gdk_devices_list (void);
#ifndef GTK_DISABLE_DEPRECATED
GdkDevice *gdk_device_get_core_pointer (void);
#endif
#endif /* GDK_MULTIHEAD_SAFE */
void gdk_input_set_extension_events (GdkWindow *window,
gint mask,
GdkExtensionMode mode);
#endif /* !GDK_MULTIDEVICE_SAFE && GDK_DISABLE_DEPRECATED */
G_END_DECLS
#endif /* __GDK_INPUT_H__ */
......@@ -176,7 +176,6 @@ typedef struct
guint implicit_ungrab : 1;
} GdkDeviceGrabInfo;
typedef struct _GdkInputWindow GdkInputWindow;
typedef struct _GdkWindowPaint GdkWindowPaint;
typedef void (* GdkDisplayPointerInfoForeach) (GdkDisplay *display,
......@@ -253,7 +252,6 @@ struct _GdkWindow
guint num_offscreen_children;
GdkWindowPaint *implicit_paint;
GdkInputWindow *input_window; /* only set for impl windows */
GList *outstanding_moves;
......@@ -527,10 +525,6 @@ cairo_region_t *_gdk_window_calculate_full_clip_region (GdkWindow *window
gint *base_y_offset);
gboolean _gdk_window_has_impl (GdkWindow *window);
GdkWindow * _gdk_window_get_impl_window (GdkWindow *window);
GdkWindow *_gdk_window_get_input_window_for_event (GdkWindow *native_window,
GdkEventType event_type,
int x, int y,
gulong serial);
/*****************************
* offscreen window routines *
......
......@@ -1699,67 +1699,6 @@ gdk_window_reparent (GdkWindow *window,
_gdk_synthesize_crossing_events_for_geometry_change (window);
}
static gboolean
temporary_disable_extension_events (GdkWindow*window)
{
GdkWindow*child;
GList *l;
gboolean res;
if (window->extension_events != 0)
{
g_object_set_data (G_OBJECT (window),
"gdk-window-extension-events",
GINT_TO_POINTER (window->extension_events));
gdk_input_set_extension_events ((GdkWindow *)window, 0,
GDK_EXTENSION_EVENTS_NONE);
}
else
res = FALSE;
for (l = window->children; l != NULL; l = l->next)
{
child = l->data;
if (window->impl_window == child->impl_window)
res |= temporary_disable_extension_events (child);
}
return res;
}
static void
reenable_extension_events (GdkWindow *window)
{
GdkWindow *child;
GList *l;
int mask;
mask = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (window),
"gdk-window-extension-events"));
if (mask != 0)
{
/* We don't have the mode here, so we pass in cursor.
This works with the current code since mode is not
stored except as part of the mask, and cursor doesn't
change the mask. */
gdk_input_set_extension_events ((GdkWindow *)window, mask,
GDK_EXTENSION_EVENTS_CURSOR);
g_object_set_data (G_OBJECT (window),
"gdk-window-extension-events",
NULL);
}
for (l = window->children; l != NULL; l = l->next)
{
child = l->data;
if (window->impl_window == child->impl_window)
reenable_extension_events (window);
}
}
/**
* gdk_window_ensure_native:
* @window: a #GdkWindow
......@@ -1784,7 +1723,6 @@ gdk_window_ensure_native (GdkWindow *window)
GdkWindow *above;
GList listhead;
GdkWindowImplClass *impl_class;
gboolean disabled_extension_events;
g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
......@@ -1803,12 +1741,6 @@ gdk_window_ensure_native (GdkWindow *window)
/* Need to create a native window */
/* First we disable any extension events on the window or its
descendants to handle the native input window moving */
disabled_extension_events = FALSE;
if (impl_window->input_window)
disabled_extension_events = temporary_disable_extension_events (window);
gdk_window_drop_cairo_surface (window);
screen = gdk_window_get_screen (window);
......@@ -1859,9 +1791,6 @@ gdk_window_ensure_native (GdkWindow *window)
if (gdk_window_is_viewable (window))
impl_class->show (window, FALSE);
if (disabled_extension_events)
reenable_extension_events (window);
return TRUE;
}
......@@ -9814,88 +9743,6 @@ _gdk_windowing_got_event (GdkDisplay *display,
}
}
static GdkWindow *
get_extension_event_window (GdkDisplay *display,
GdkWindow *pointer_window,
GdkEventType type,
gulong serial)
{
guint evmask;
GdkWindow *w, *grab_window;
GdkDeviceGrabInfo *grab;
/* FIXME: which device? */
grab = _gdk_display_has_device_grab (display, display->core_pointer, serial);
if (grab != NULL && !grab->owner_events)
{
evmask = grab->event_mask;
grab_window = grab->window;
if (evmask & type_masks[type])
return grab_window;
else
return NULL;
}
w = pointer_window;
while (w != NULL)
{
evmask = w->extension_events;
if (evmask & type_masks[type])
return w;
w = get_event_parent (w);
}
if (grab != NULL &&
grab->owner_events)
{
evmask = grab->event_mask;
if (evmask & type_masks[type])
return grab->window;
else
return NULL;
}
return NULL;
}
GdkWindow *
_gdk_window_get_input_window_for_event (GdkWindow *native_window,
GdkEventType event_type,
int x, int y,
gulong serial)
{
GdkDisplay *display;
GdkWindow *toplevel_window;
GdkWindow *pointer_window;
GdkWindow *event_win;
gdouble toplevel_x, toplevel_y;
toplevel_x = x;
toplevel_y = y;
display = gdk_window_get_display (native_window);
toplevel_window = convert_native_coords_to_toplevel (native_window,
toplevel_x, toplevel_y,
&toplevel_x, &toplevel_y);
/* FIXME: which device? */
pointer_window = get_pointer_window (display, toplevel_window, NULL,
toplevel_x, toplevel_y, serial);
event_win = get_extension_event_window (display,
pointer_window,
event_type,
serial);
return event_win;
}
/**
* gdk_window_create_similar_surface:
* @window: window to make new surface similar to
......
......@@ -37,7 +37,6 @@ libgdk_x11_la_SOURCES = \
gdkgeometry-x11.c \
gdkglobals-x11.c \
gdkim-x11.c \
gdkinput.c \
gdkkeys-x11.c \
gdkmain-x11.c \
gdkproperty-x11.c \
......
/* GDK - The GIMP Drawing Kit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include "config.h"
#include "gdkscreen-x11.h"
#include "gdkdisplay-x11.h"
#include "gdkwindow.h"
#include <stdlib.h>
/* Addition used for extension_events mask */
#define GDK_ALL_DEVICES_MASK (1<<30)
struct _GdkInputWindow
{
GList *windows; /* GdkWindow:s with extension_events set */
/* gdk window */
GdkWindow *impl_window; /* an impl window */
};
/**
* gdk_devices_list:
*
* Returns the list of available input devices for the default display.
* The list is statically allocated and should not be freed.
*
* Return value: (transfer none) (element-type GdkDevice): a list of #GdkDevice
*
* Deprecated: 3.0: Use gdk_device_manager_list_devices() instead.
**/
GList *
gdk_devices_list (void)
{
return gdk_display_list_devices (gdk_display_get_default ());
}
static void
_gdk_input_select_device_events (GdkWindow *impl_window,
GdkDevice *device)
{
guint event_mask;
GdkWindow *w;
GdkInputWindow *iw;
GdkInputMode mode;
gboolean has_cursor;
GdkDeviceType type;
GList *l;
event_mask = 0;
iw = impl_window->input_window;
g_object_get (device,
"type", &type,
"input-mode", &mode,
"has-cursor", &has_cursor,
NULL);
if (iw == NULL ||
mode == GDK_MODE_DISABLED ||
type == GDK_DEVICE_TYPE_MASTER)
return;
for (l = iw->windows; l != NULL; l = l->next)
{
w = l->data;
if (has_cursor || (w->extension_events & GDK_ALL_DEVICES_MASK))
{
event_mask = w->extension_events;
if (event_mask)
event_mask |= GDK_PROXIMITY_OUT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK;
gdk_window_set_device_events (w, device, event_mask);
}
}
}
static void
unset_extension_events (GdkWindow *window)
{
GdkWindow *impl_window;
GdkDisplayX11 *display_x11;
GdkInputWindow *iw;
impl_window = _gdk_window_get_impl_window (window);
iw = impl_window->input_window;
display_x11 = GDK_DISPLAY_X11 (GDK_WINDOW_DISPLAY (window));
if (window->extension_events != 0)
{
g_assert (iw != NULL);
g_assert (g_list_find (iw->windows, window) != NULL);
iw->windows = g_list_remove (iw->windows, window);
if (iw->windows == NULL)
{
impl_window->input_window = NULL;
display_x11->input_windows = g_list_remove (display_x11->input_windows, iw);
g_free (iw);
}
}
window->extension_events = 0;
}
/**
* gdk_input_set_extension_events:
* @window: a #GdkWindow.
* @mask: the event mask
* @mode: the type of extension events that are desired.
*
* Turns extension events on or off for a particular window,
* and specifies the event mask for extension events.
*
* Deprecated: 3.0: Use gdk_window_set_device_events() instead.
**/
void
gdk_input_set_extension_events (GdkWindow *window,
gint mask,
GdkExtensionMode mode)
{
GdkWindow *impl_window;
GdkInputWindow *iw;
GdkDisplayX11 *display_x11;
#ifndef XINPUT_NONE
GList *tmp_list;
#endif
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_WINDOW_IS_X11 (window));
display_x11 = GDK_DISPLAY_X11 (GDK_WINDOW_DISPLAY (window));
if (GDK_WINDOW_DESTROYED (window))
return;
impl_window = _gdk_window_get_impl_window (window);
if (mode == GDK_EXTENSION_EVENTS_ALL && mask != 0)
mask |= GDK_ALL_DEVICES_MASK;
if (mode == GDK_EXTENSION_EVENTS_NONE)
mask = 0;
iw = impl_window->input_window;
if (mask != 0)
{
if (!iw)
{
iw = g_new0 (GdkInputWindow,1);
iw->impl_window = (GdkWindow *)impl_window;
iw->windows = NULL;
display_x11->input_windows = g_list_append (display_x11->input_windows, iw);
impl_window->input_window = iw;
}
if (window->extension_events == 0)
iw->windows = g_list_append (iw->windows, window);
window->extension_events = mask;
}
else
{
unset_extension_events (window);
}
#ifndef XINPUT_NONE
for (tmp_list = display_x11->input_devices; tmp_list; tmp_list = tmp_list->next)
{
GdkDevice *dev = tmp_list->data;
_gdk_input_select_device_events (GDK_WINDOW (impl_window), dev);
}
#endif /* !XINPUT_NONE */
}
void
_gdk_input_window_destroy (GdkWindow *window)
{
unset_extension_events (window);
}
void
_gdk_input_check_extension_events (GdkDevice *device)
{
GdkDisplayX11 *display_impl;
GdkInputWindow *input_window;
GList *tmp_list;
display_impl = GDK_DISPLAY_X11 (gdk_device_get_display (device));
for (tmp_list = display_impl->input_windows; tmp_list; tmp_list = tmp_list->next)
{
input_window = tmp_list->data;
_gdk_input_select_device_events (input_window->impl_window, device);
}
}
......@@ -3408,7 +3408,6 @@ gtk_widget_get_direction
gtk_widget_get_display
gtk_widget_get_double_buffered
gtk_widget_get_events
gtk_widget_get_extension_events
gtk_widget_get_halign
gtk_widget_get_has_tooltip
gtk_widget_get_has_window
......@@ -3554,7 +3553,6 @@ gtk_widget_set_device_events
gtk_widget_set_direction
gtk_widget_set_double_buffered
gtk_widget_set_events
gtk_widget_set_extension_events
gtk_widget_set_halign
gtk_widget_set_has_tooltip
gtk_widget_set_has_window
......
......@@ -24,8 +24,6 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#undef GDK_DISABLE_DEPRECATED /* gdk_input_set_extension_events() */
#include "config.h"
#include <stdarg.h>
#include <string.h>
......@@ -467,7 +465,6 @@ enum {
PROP_COMPOSITE_CHILD,
PROP_STYLE,
PROP_EVENTS,
PROP_EXTENSION_EVENTS,
PROP_NO_SHOW_ALL,
PROP_HAS_TOOLTIP,
PROP_TOOLTIP_MARKUP,
......@@ -669,7 +666,6 @@ static GQuark quark_accel_path = 0;
static GQuark quark_accel_closures = 0;
static GQuark quark_event_mask = 0;
static GQuark quark_device_event_mask = 0;
static GQuark quark_extension_event_mode = 0;
static GQuark quark_parent_window = 0;
static GQuark quark_pointer_window = 0;
static GQuark quark_shape_info = 0;
......@@ -783,7 +779,6 @@ gtk_widget_class_init (GtkWidgetClass *klass)
quark_accel_closures = g_quark_from_static_string ("gtk-accel-closures");
quark_event_mask = g_quark_from_static_string ("gtk-event-mask");
quark_device_event_mask = g_quark_from_static_string ("gtk-device-event-mask");
quark_extension_event_mode = g_quark_from_static_string ("gtk-extension-event-mode");
quark_parent_window = g_quark_from_static_string ("gtk-parent-window");
quark_pointer_window = g_quark_from_static_string ("gtk-pointer-window");
quark_shape_info = g_quark_from_static_string ("gtk-shape-info");
......@@ -1000,14 +995,6 @@ gtk_widget_class_init (GtkWidgetClass *klass)
GDK_TYPE_EVENT_MASK,
GDK_STRUCTURE_MASK,
GTK_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
PROP_EXTENSION_EVENTS,
g_param_spec_enum ("extension-events",
P_("Extension events"),
P_("The mask that decides what kind of extension events this widget gets"),
GDK_TYPE_EXTENSION_MODE,
GDK_EXTENSION_EVENTS_NONE,
GTK_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
PROP_NO_SHOW_ALL,
g_param_spec_boolean ("no-show-all",
......@@ -3231,9 +3218,6 @@ gtk_widget_set_property (GObject *object,
if (!gtk_widget_get_realized (widget) && gtk_widget_get_has_window (widget))
gtk_widget_set_events (widget, g_value_get_flags (value));
break;
case PROP_EXTENSION_EVENTS:
gtk_widget_set_extension_events (widget, g_value_get_enum (value));