diff --git a/docs/reference/gdk/gdk4-sections.txt b/docs/reference/gdk/gdk4-sections.txt index 0132380967..5997eebe8c 100644 --- a/docs/reference/gdk/gdk4-sections.txt +++ b/docs/reference/gdk/gdk4-sections.txt @@ -49,7 +49,6 @@ gdk_input_source_get_type gdk_modifier_intent_get_type gdk_modifier_type_get_type gdk_notify_type_get_type -gdk_property_state_get_type gdk_prop_mode_get_type gdk_scroll_direction_get_type gdk_setting_action_get_type @@ -417,13 +416,6 @@ gdk_utf8_to_string_target gdk_atom_intern gdk_atom_intern_static_string gdk_atom_name -gdk_property_get -gdk_property_change -GdkPropMode -gdk_property_delete - - -GDK_TYPE_PROP_MODE
diff --git a/gdk/broadway/gdkprivate-broadway.h b/gdk/broadway/gdkprivate-broadway.h index 3cdc55e928..161d03367d 100644 --- a/gdk/broadway/gdkprivate-broadway.h +++ b/gdk/broadway/gdkprivate-broadway.h @@ -57,25 +57,6 @@ void _gdk_broadway_window_translate (GdkWindow *window, cairo_region_t *area, gint dx, gint dy); -gboolean _gdk_broadway_window_get_property (GdkWindow *window, - GdkAtom property, - GdkAtom type, - gulong offset, - gulong length, - gint pdelete, - GdkAtom *actual_property_type, - gint *actual_format_type, - gint *actual_length, - guchar **data); -void _gdk_broadway_window_change_property (GdkWindow *window, - GdkAtom property, - GdkAtom type, - gint format, - GdkPropMode mode, - const guchar *data, - gint nelements); -void _gdk_broadway_window_delete_property (GdkWindow *window, - GdkAtom property); gboolean _gdk_broadway_moveresize_handle_event (GdkDisplay *display, BroadwayInputMsg *msg); gboolean _gdk_broadway_moveresize_configure_done (GdkDisplay *display, diff --git a/gdk/broadway/gdkproperty-broadway.c b/gdk/broadway/gdkproperty-broadway.c deleted file mode 100644 index 0caaf30688..0000000000 --- a/gdk/broadway/gdkproperty-broadway.c +++ /dev/null @@ -1,67 +0,0 @@ -/* 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, see . - */ - -/* - * 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 "gdkproperty.h" - -#include "gdkinternals.h" -#include "gdkdisplay-broadway.h" -#include "gdkprivate-broadway.h" - -#include - -gboolean -_gdk_broadway_window_get_property (GdkWindow *window, - GdkAtom property, - GdkAtom type, - gulong offset, - gulong length, - gint pdelete, - GdkAtom *actual_property_type, - gint *actual_format_type, - gint *actual_length, - guchar **data) -{ - return FALSE; -} - -void -_gdk_broadway_window_change_property (GdkWindow *window, - GdkAtom property, - GdkAtom type, - gint format, - GdkPropMode mode, - const guchar *data, - gint nelements) -{ - g_return_if_fail (!window || GDK_WINDOW_IS_BROADWAY (window)); -} - -void -_gdk_broadway_window_delete_property (GdkWindow *window, - GdkAtom property) -{ - g_return_if_fail (!window || GDK_WINDOW_IS_BROADWAY (window)); -} diff --git a/gdk/broadway/gdkwindow-broadway.c b/gdk/broadway/gdkwindow-broadway.c index 89d79b8221..12fb5256e3 100644 --- a/gdk/broadway/gdkwindow-broadway.c +++ b/gdk/broadway/gdkwindow-broadway.c @@ -1425,7 +1425,4 @@ gdk_window_impl_broadway_class_init (GdkWindowImplBroadwayClass *klass) impl_class->destroy_notify = gdk_broadway_window_destroy_notify; impl_class->register_dnd = _gdk_broadway_window_register_dnd; impl_class->drag_begin = _gdk_broadway_window_drag_begin; - impl_class->get_property = _gdk_broadway_window_get_property; - impl_class->change_property = _gdk_broadway_window_change_property; - impl_class->delete_property = _gdk_broadway_window_delete_property; } diff --git a/gdk/broadway/meson.build b/gdk/broadway/meson.build index c1c0f72855..614a623784 100644 --- a/gdk/broadway/meson.build +++ b/gdk/broadway/meson.build @@ -11,7 +11,6 @@ gdk_broadway_sources = files([ 'gdkglobals-broadway.c', 'gdkkeys-broadway.c', 'gdkmonitor-broadway.c', - 'gdkproperty-broadway.c', 'gdkselection-broadway.c', 'gdkwindow-broadway.c', ]) diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c index 823b39487b..db702b2a63 100644 --- a/gdk/gdkevents.c +++ b/gdk/gdkevents.c @@ -838,8 +838,6 @@ gdk_event_get_time (const GdkEvent *event) case GDK_ENTER_NOTIFY: case GDK_LEAVE_NOTIFY: return event->crossing.time; - case GDK_PROPERTY_NOTIFY: - return event->property.time; case GDK_PROXIMITY_IN: case GDK_PROXIMITY_OUT: return event->proximity.time; @@ -930,7 +928,6 @@ gdk_event_get_state (const GdkEvent *event, case GDK_LEAVE_NOTIFY: *state = event->crossing.state; return TRUE; - case GDK_PROPERTY_NOTIFY: case GDK_CLIENT_EVENT: case GDK_CONFIGURE: case GDK_FOCUS_CHANGE: @@ -2603,32 +2600,6 @@ gdk_event_get_pad_axis_value (const GdkEvent *event, return FALSE; } -/** - * gdk_event_get_property: - * @event: a #GdkEvent - * @property: (out): - * @state: (out): - * - * Returns: %TRUE on success, otherwise %FALSE - **/ -gboolean -gdk_event_get_property (const GdkEvent *event, - GdkAtom *property, - GdkPropertyState *state) -{ - if (!event) - return FALSE; - - if (event->any.type == GDK_PROPERTY_NOTIFY) - { - *property = event->property.atom; - *state = event->property.state; - return TRUE; - } - - return FALSE; -} - /** * gdk_event_get_axes: * @event: a #GdkEvent diff --git a/gdk/gdkevents.h b/gdk/gdkevents.h index 65a00cc494..cbb0ca72ed 100644 --- a/gdk/gdkevents.h +++ b/gdk/gdkevents.h @@ -135,8 +135,6 @@ typedef struct _GdkEventKey GdkEventKey; typedef struct _GdkEventFocus GdkEventFocus; typedef struct _GdkEventCrossing GdkEventCrossing; typedef struct _GdkEventConfigure GdkEventConfigure; -typedef struct _GdkEventProperty GdkEventProperty; -typedef struct _GdkEventOwnerChange GdkEventOwnerChange; typedef struct _GdkEventProximity GdkEventProximity; typedef struct _GdkEventDND GdkEventDND; typedef struct _GdkEventWindowState GdkEventWindowState; @@ -234,7 +232,6 @@ typedef GdkFilterReturn (*GdkFilterFunc) (GdkXEvent *xevent, * Note that GTK+ discards these events for %GDK_WINDOW_CHILD windows. * @GDK_MAP: the window has been mapped. * @GDK_UNMAP: the window has been unmapped. - * @GDK_PROPERTY_NOTIFY: a property on the window has been changed or deleted. * @GDK_PROXIMITY_IN: an input device has moved into contact with a sensing * surface (e.g. a touchscreen or graphics tablet). * @GDK_PROXIMITY_OUT: an input device has moved out of contact with a sensing @@ -302,7 +299,6 @@ typedef enum GDK_CONFIGURE = 13, GDK_MAP = 14, GDK_UNMAP = 15, - GDK_PROPERTY_NOTIFY = 16, GDK_PROXIMITY_IN = 20, GDK_PROXIMITY_OUT = 21, GDK_DRAG_ENTER = 22, @@ -450,19 +446,6 @@ typedef enum GDK_CROSSING_DEVICE_SWITCH } GdkCrossingMode; -/** - * GdkPropertyState: - * @GDK_PROPERTY_NEW_VALUE: the property value was changed. - * @GDK_PROPERTY_DELETE: the property was deleted. - * - * Specifies the type of a property change for a #GdkEventProperty. - */ -typedef enum -{ - GDK_PROPERTY_NEW_VALUE, - GDK_PROPERTY_DELETE -} GdkPropertyState; - /** * GdkWindowState: * @GDK_WINDOW_STATE_WITHDRAWN: the window is not shown. @@ -709,10 +692,6 @@ gboolean gdk_event_get_pad_axis_value (const GdkEvent *event, guint *index, gdouble *value); GDK_AVAILABLE_IN_3_92 -gboolean gdk_event_get_property (const GdkEvent *event, - GdkAtom *property, - GdkPropertyState *state); -GDK_AVAILABLE_IN_3_92 gboolean gdk_event_get_axes (GdkEvent *event, gdouble **axes, guint *n_axes); diff --git a/gdk/gdkeventsprivate.h b/gdk/gdkeventsprivate.h index b9fc789b81..feb6346292 100644 --- a/gdk/gdkeventsprivate.h +++ b/gdk/gdkeventsprivate.h @@ -380,26 +380,6 @@ struct _GdkEventConfigure gint height; }; -/** - * GdkEventProperty: - * @type: the type of the event (%GDK_PROPERTY_NOTIFY). - * @window: the window which received the event. - * @send_event: %TRUE if the event was sent explicitly. - * @atom: the property that was changed. - * @time: the time of the event in milliseconds. - * @state: (type GdkPropertyState): whether the property was changed - * (%GDK_PROPERTY_NEW_VALUE) or deleted (%GDK_PROPERTY_DELETE). - * - * Describes a property change on a window. - */ -struct _GdkEventProperty -{ - GdkEventAny any; - GdkAtom atom; - guint32 time; - guint state; -}; - /** * GdkEventProximity: * @type: the type of the event (%GDK_PROXIMITY_IN or %GDK_PROXIMITY_OUT). @@ -658,7 +638,6 @@ struct _GdkEventPadGroupMode { * @crossing: a #GdkEventCrossing * @focus_change: a #GdkEventFocus * @configure: a #GdkEventConfigure - * @property: a #GdkEventProperty * @proximity: a #GdkEventProximity * @dnd: a #GdkEventDND * @window_state: a #GdkEventWindowState @@ -712,7 +691,6 @@ union _GdkEvent GdkEventCrossing crossing; GdkEventFocus focus_change; GdkEventConfigure configure; - GdkEventProperty property; GdkEventProximity proximity; GdkEventDND dnd; GdkEventWindowState window_state; diff --git a/gdk/gdkproperty.h b/gdk/gdkproperty.h index 85420e55cb..565ca98b92 100644 --- a/gdk/gdkproperty.h +++ b/gdk/gdkproperty.h @@ -35,23 +35,6 @@ G_BEGIN_DECLS -/** - * GdkPropMode: - * @GDK_PROP_MODE_REPLACE: the new data replaces the existing data. - * @GDK_PROP_MODE_PREPEND: the new data is prepended to the existing data. - * @GDK_PROP_MODE_APPEND: the new data is appended to the existing data. - * - * Describes how existing data is combined with new data when - * using gdk_property_change(). - */ -typedef enum -{ - GDK_PROP_MODE_REPLACE, - GDK_PROP_MODE_PREPEND, - GDK_PROP_MODE_APPEND -} GdkPropMode; - - GDK_AVAILABLE_IN_ALL GdkAtom gdk_atom_intern (const gchar *atom_name, gboolean only_if_exists); @@ -61,29 +44,6 @@ GDK_AVAILABLE_IN_ALL gchar* gdk_atom_name (GdkAtom atom); -GDK_AVAILABLE_IN_ALL -gboolean gdk_property_get (GdkWindow *window, - GdkAtom property, - GdkAtom type, - gulong offset, - gulong length, - gint pdelete, - GdkAtom *actual_property_type, - gint *actual_format, - gint *actual_length, - guchar **data); -GDK_AVAILABLE_IN_ALL -void gdk_property_change (GdkWindow *window, - GdkAtom property, - GdkAtom type, - gint format, - GdkPropMode mode, - const guchar *data, - gint nelements); -GDK_AVAILABLE_IN_ALL -void gdk_property_delete (GdkWindow *window, - GdkAtom property); - GDK_AVAILABLE_IN_ALL gint gdk_text_property_to_utf8_list_for_display (GdkDisplay *display, GdkAtom encoding, diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c index c65c34eda6..e6f9fa3791 100644 --- a/gdk/gdkwindow.c +++ b/gdk/gdkwindow.c @@ -5463,11 +5463,6 @@ _gdk_make_event (GdkWindow *window, event->crossing.state = the_state; break; - case GDK_PROPERTY_NOTIFY: - event->property.time = the_time; - event->property.state = the_state; - break; - case GDK_PROXIMITY_IN: case GDK_PROXIMITY_OUT: event->proximity.time = the_time; @@ -6906,119 +6901,6 @@ gdk_drag_begin (GdkWindow *window, return GDK_WINDOW_IMPL_GET_CLASS (window->impl)->drag_begin (window, device, content, actions, dx, dy); } -/** - * gdk_property_get: - * @window: a #GdkWindow - * @property: the property to retrieve - * @type: the desired property type, or %NULL, if any type of data - * is acceptable. If this does not match the actual - * type, then @actual_format and @actual_length will - * be filled in, a warning will be printed to stderr - * and no data will be returned. - * @offset: the offset into the property at which to begin - * retrieving data, in 4 byte units. - * @length: the length of the data to retrieve in bytes. Data is - * considered to be retrieved in 4 byte chunks, so @length - * will be rounded up to the next highest 4 byte boundary - * (so be careful not to pass a value that might overflow - * when rounded up). - * @pdelete: if %TRUE, delete the property after retrieving the - * data. - * @actual_property_type: (out) (transfer none): location to store the - * actual type of the property. - * @actual_format: (out): location to store the actual return format of the - * data; either 8, 16 or 32 bits. - * @actual_length: location to store the length of the retrieved data, in - * bytes. Data returned in the 32 bit format is stored - * in a long variable, so the actual number of 32 bit - * elements should be be calculated via - * @actual_length / sizeof(glong) to ensure portability to - * 64 bit systems. - * @data: (out) (array length=actual_length) (transfer full): location - * to store a pointer to the data. The retrieved data should be - * freed with g_free() when you are finished using it. - * - * Retrieves a portion of the contents of a property. If the - * property does not exist, then the function returns %FALSE, - * and %NULL will be stored in @actual_property_type. - * - * The XGetWindowProperty() function that gdk_property_get() - * uses has a very confusing and complicated set of semantics. - * Unfortunately, gdk_property_get() makes the situation - * worse instead of better (the semantics should be considered - * undefined), and also prints warnings to stderr in cases where it - * should return a useful error to the program. You are advised to use - * XGetWindowProperty() directly until a replacement function for - * gdk_property_get() is provided. - * - * Returns: %TRUE if data was successfully received and stored - * in @data, otherwise %FALSE. - */ -gboolean -gdk_property_get (GdkWindow *window, - GdkAtom property, - GdkAtom type, - gulong offset, - gulong length, - gint pdelete, - GdkAtom *actual_property_type, - gint *actual_format_type, - gint *actual_length, - guchar **data) -{ - return GDK_WINDOW_IMPL_GET_CLASS (window->impl) - ->get_property (window, property, type, offset, length, pdelete, - actual_property_type, actual_format_type, - actual_length, data); -} - -/** - * gdk_property_change: (skip) - * @window: a #GdkWindow - * @property: the property to change - * @type: the new type for the property. If @mode is - * %GDK_PROP_MODE_PREPEND or %GDK_PROP_MODE_APPEND, then this - * must match the existing type or an error will occur. - * @format: the new format for the property. If @mode is - * %GDK_PROP_MODE_PREPEND or %GDK_PROP_MODE_APPEND, then this - * must match the existing format or an error will occur. - * @mode: a value describing how the new data is to be combined - * with the current data. - * @data: the data (a `guchar *` - * `gushort *`, or `gulong *`, - * depending on @format), cast to a `guchar *`. - * @nelements: the number of elements of size determined by the format, - * contained in @data. - * - * Changes the contents of a property on a window. - */ -void -gdk_property_change (GdkWindow *window, - GdkAtom property, - GdkAtom type, - gint format, - GdkPropMode mode, - const guchar *data, - gint nelements) -{ - GDK_WINDOW_IMPL_GET_CLASS (window->impl) - ->change_property (window, property, type, format, mode, data, nelements); -} - -/** - * gdk_property_delete: - * @window: a #GdkWindow - * @property: the property to delete - * - * Deletes a property from a window. - */ -void -gdk_property_delete (GdkWindow *window, - GdkAtom property) -{ - GDK_WINDOW_IMPL_GET_CLASS (window->impl)->delete_property (window, property); -} - static void gdk_window_flush_events (GdkFrameClock *clock, void *data) diff --git a/gdk/gdkwindowimpl.h b/gdk/gdkwindowimpl.h index 4383b84538..2185b6aedc 100644 --- a/gdk/gdkwindowimpl.h +++ b/gdk/gdkwindowimpl.h @@ -227,26 +227,6 @@ struct _GdkWindowImplClass void (*process_updates_recurse) (GdkWindow *window, cairo_region_t *region); - gboolean (*get_property) (GdkWindow *window, - GdkAtom property, - GdkAtom type, - gulong offset, - gulong length, - gint pdelete, - GdkAtom *actual_type, - gint *actual_format, - gint *actual_length, - guchar **data); - void (*change_property) (GdkWindow *window, - GdkAtom property, - GdkAtom type, - gint format, - GdkPropMode mode, - const guchar *data, - gint n_elements); - void (*delete_property) (GdkWindow *window, - GdkAtom property); - gint (* get_scale_factor) (GdkWindow *window); void (* get_unscaled_size) (GdkWindow *window, int *unscaled_width, diff --git a/gdk/mir/gdkmirwindowimpl.c b/gdk/mir/gdkmirwindowimpl.c index a820170bad..910c5dfaf8 100644 --- a/gdk/mir/gdkmirwindowimpl.c +++ b/gdk/mir/gdkmirwindowimpl.c @@ -36,45 +36,12 @@ #define MAX_EGL_ATTRS 30 -typedef struct -{ - GdkAtom type; - GArray *array; -} GdkMirProperty; - -static GdkMirProperty * -gdk_mir_property_new (GdkAtom type, - guint format, - guint capacity) -{ - GdkMirProperty *property = g_slice_new (GdkMirProperty); - - property->type = type; - property->array = g_array_sized_new (TRUE, FALSE, format, capacity); - - return property; -} - -static void -gdk_mir_property_free (gpointer data) -{ - GdkMirProperty *property = data; - - if (!property) - return; - - g_array_unref (property->array); - g_slice_free (GdkMirProperty, property); -} - typedef struct _GdkMirWindowImplClass GdkMirWindowImplClass; struct _GdkMirWindowImpl { GdkWindowImpl parent_instance; - GHashTable *properties; - /* Window we are temporary for */ GdkWindow *transient_for; gint transient_x; @@ -263,7 +230,6 @@ _gdk_mir_window_impl_get_cursor_state (GdkMirWindowImpl *impl, static void gdk_mir_window_impl_init (GdkMirWindowImpl *impl) { - impl->properties = g_hash_table_new_full (NULL, NULL, NULL, gdk_mir_property_free); impl->type_hint = GDK_WINDOW_TYPE_HINT_NORMAL; impl->window_state = mir_window_state_unknown; impl->output_scale = 1; @@ -808,7 +774,6 @@ gdk_mir_window_impl_finalize (GObject *object) g_clear_pointer (&impl->mir_window, mir_window_release_sync); g_clear_pointer (&impl->cairo_surface, cairo_surface_destroy); - g_clear_pointer (&impl->properties, g_hash_table_unref); G_OBJECT_CLASS (gdk_mir_window_impl_parent_class)->finalize (object); } @@ -1690,298 +1655,6 @@ gdk_mir_window_impl_process_updates_recurse (GdkWindow *window, _gdk_window_process_updates_recurse (window, region); } -static gboolean -gdk_mir_window_impl_get_property (GdkWindow *window, - GdkAtom property, - GdkAtom type, - gulong offset, - gulong length, - gint pdelete, - GdkAtom *actual_type, - gint *actual_format, - gint *actual_length, - guchar **data) -{ - GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl); - GdkMirProperty *mir_property; - GdkAtom dummy_actual_type; - gint dummy_actual_format; - gint dummy_actual_length; - guint width; - - if (!actual_type) - actual_type = &dummy_actual_type; - if (!actual_format) - actual_format = &dummy_actual_format; - if (!actual_length) - actual_length = &dummy_actual_length; - - *actual_type = NULL; - *actual_format = 0; - *actual_length = 0; - - if (data) - *data = NULL; - - mir_property = g_hash_table_lookup (impl->properties, property); - - if (!mir_property) - return FALSE; - - width = g_array_get_element_size (mir_property->array); - *actual_type = mir_property->type; - *actual_format = 8 * width; - - /* ICCCM 2.7: GdkAtoms can be 64-bit, but ATOMs and ATOM_PAIRs have format 32 */ - if (*actual_type == GDK_SELECTION_TYPE_ATOM || *actual_type == gdk_atom_intern_static_string ("ATOM_PAIR")) - *actual_format = 32; - - if (type != NULL && type != mir_property->type) - return FALSE; - - offset *= 4; - - /* round up to next nearest multiple of width */ - if (length < G_MAXULONG - width + 1) - length = (length - 1 + width) / width * width; - else - length = G_MAXULONG / width * width; - - /* we're skipping the first offset bytes */ - if (length > mir_property->array->len * width - offset) - length = mir_property->array->len * width - offset; - - /* leave room for null terminator */ - if (length > G_MAXULONG - width) - length -= width; - - *actual_length = length; - - if (data) - { - *data = g_memdup (mir_property->array->data + offset, length + width); - memset (*data + length, 0, width); - } - - return TRUE; -} - -static void -request_targets (GdkWindow *window, - const GdkAtom *available_targets, - gint n_available_targets) -{ - GArray *requested_targets; - GdkAtom target_pair[2]; - gchar *target_location; - GdkEvent *event; - gint i; - - requested_targets = g_array_sized_new (TRUE, FALSE, sizeof (GdkAtom), 2 * n_available_targets); - - for (i = 0; i < n_available_targets; i++) - { - target_pair[0] = available_targets[i]; - - if (target_pair[0] == gdk_atom_intern_static_string ("TIMESTAMP") || - target_pair[0] == gdk_atom_intern_static_string ("TARGETS") || - target_pair[0] == gdk_atom_intern_static_string ("MULTIPLE") || - target_pair[0] == gdk_atom_intern_static_string ("SAVE_TARGETS")) - continue; - - target_location = g_strdup_printf ("REQUESTED_TARGET_U%u", requested_targets->len / 2); - target_pair[1] = gdk_atom_intern (target_location, FALSE); - g_free (target_location); - - g_array_append_vals (requested_targets, target_pair, 2); - } - - gdk_property_delete (window, gdk_atom_intern_static_string ("AVAILABLE_TARGETS")); - gdk_property_delete (window, gdk_atom_intern_static_string ("REQUESTED_TARGETS")); - - gdk_property_change (window, - gdk_atom_intern_static_string ("REQUESTED_TARGETS"), - GDK_SELECTION_TYPE_ATOM, - 8 * sizeof (GdkAtom), - GDK_PROP_MODE_REPLACE, - (const guchar *) requested_targets->data, - requested_targets->len); - - g_array_unref (requested_targets); - - event = gdk_event_new (GDK_SELECTION_REQUEST); - event->selection.window = g_object_ref (window); - event->selection.send_event = FALSE; - event->selection.selection = GDK_SELECTION_CLIPBOARD; - event->selection.target = gdk_atom_intern_static_string ("MULTIPLE"); - event->selection.property = gdk_atom_intern_static_string ("REQUESTED_TARGETS"); - event->selection.time = GDK_CURRENT_TIME; - event->selection.requestor = g_object_ref (window); - - gdk_event_put (event); - gdk_event_free (event); -} - -static void -create_paste (GdkWindow *window, - const GdkAtom *requested_targets, - gint n_requested_targets) -{ - GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl); - GPtrArray *paste_formats; - GArray *paste_header; - GByteArray *paste_data; - gint sizes[4]; - GdkMirProperty *mir_property; - const gchar *paste_format; - gint i; - - paste_formats = g_ptr_array_new_full (n_requested_targets, g_free); - paste_header = g_array_sized_new (FALSE, FALSE, sizeof (gint), 1 + 4 * n_requested_targets); - paste_data = g_byte_array_new (); - - g_array_append_val (paste_header, sizes[0]); - - for (i = 0; i < n_requested_targets; i++) - { - if (requested_targets[i] == NULL) - continue; - - mir_property = g_hash_table_lookup (impl->properties, requested_targets[i]); - - if (!mir_property) - continue; - - paste_format = _gdk_atom_name_const (mir_property->type); - - /* skip non-MIME targets */ - if (!strchr (paste_format, '/')) - { - g_hash_table_remove (impl->properties, requested_targets[i]); - continue; - } - - sizes[0] = paste_data->len; - sizes[1] = strlen (paste_format); - sizes[2] = sizes[0] + sizes[1]; - sizes[3] = mir_property->array->len * g_array_get_element_size (mir_property->array); - - g_ptr_array_add (paste_formats, g_strdup (paste_format)); - g_array_append_vals (paste_header, sizes, 4); - g_byte_array_append (paste_data, (const guint8 *) paste_format, sizes[1]); - g_byte_array_append (paste_data, (const guint8 *) mir_property->array->data, sizes[3]); - - g_hash_table_remove (impl->properties, requested_targets[i]); - } - - gdk_property_delete (window, gdk_atom_intern_static_string ("REQUESTED_TARGETS")); - - g_array_index (paste_header, gint, 0) = paste_formats->len; - - for (i = 0; i < paste_formats->len; i++) - { - g_array_index (paste_header, gint, 1 + 4 * i) += paste_header->len * sizeof (gint); - g_array_index (paste_header, gint, 3 + 4 * i) += paste_header->len * sizeof (gint); - } - - g_byte_array_prepend (paste_data, - (const guint8 *) paste_header->data, - paste_header->len * g_array_get_element_size (paste_header)); - - g_ptr_array_add (paste_formats, NULL); - - _gdk_mir_display_create_paste (gdk_window_get_display (window), - (const gchar * const *) paste_formats->pdata, - paste_data->data, - paste_data->len); - - g_byte_array_unref (paste_data); - g_array_unref (paste_header); - g_ptr_array_unref (paste_formats); -} - -static void -gdk_mir_window_impl_change_property (GdkWindow *window, - GdkAtom property, - GdkAtom type, - gint format, - GdkPropMode mode, - const guchar *data, - gint n_elements) -{ - GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl); - GdkMirProperty *mir_property; - gboolean existed; - GdkEvent *event; - - /* ICCCM 2.7: ATOMs and ATOM_PAIRs have format 32, but GdkAtoms can be 64-bit */ - if (type == GDK_SELECTION_TYPE_ATOM || type == gdk_atom_intern_static_string ("ATOM_PAIR")) - format = 8 * sizeof (GdkAtom); - - if (mode != GDK_PROP_MODE_REPLACE) - { - mir_property = g_hash_table_lookup (impl->properties, property); - existed = mir_property != NULL; - } - else - { - mir_property = NULL; - existed = g_hash_table_contains (impl->properties, property); - } - - if (!mir_property) - { - /* format is measured in bits, but we need to know this in bytes */ - mir_property = gdk_mir_property_new (type, format / 8, n_elements); - g_hash_table_insert (impl->properties, property, mir_property); - } - - /* format is measured in bits, but we need to know this in bytes */ - if (type != mir_property->type || format / 8 != g_array_get_element_size (mir_property->array)) - return; - - if (mode == GDK_PROP_MODE_PREPEND) - g_array_prepend_vals (mir_property->array, data, n_elements); - else - g_array_append_vals (mir_property->array, data, n_elements); - - event = gdk_event_new (GDK_PROPERTY_NOTIFY); - event->property.window = g_object_ref (window); - event->property.send_event = FALSE; - event->property.atom = property; - event->property.time = GDK_CURRENT_TIME; - event->property.state = GDK_PROPERTY_NEW_VALUE; - - gdk_event_put (event); - gdk_event_free (event); - - if (property == gdk_atom_intern_static_string ("AVAILABLE_TARGETS")) - request_targets (window, (const GdkAtom *) data, n_elements); - else if (property == gdk_atom_intern_static_string ("REQUESTED_TARGETS") && existed) - create_paste (window, (const GdkAtom *) data, n_elements); -} - -static void -gdk_mir_window_impl_delete_property (GdkWindow *window, - GdkAtom property) -{ - GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl); - GdkEvent *event; - - if (g_hash_table_remove (impl->properties, property)) - { - event = gdk_event_new (GDK_PROPERTY_NOTIFY); - event->property.window = g_object_ref (window); - event->property.send_event = FALSE; - event->property.atom = property; - event->property.time = GDK_CURRENT_TIME; - event->property.state = GDK_PROPERTY_DELETE; - - gdk_event_put (event); - gdk_event_free (event); - } -} - static gint gdk_mir_window_impl_get_scale_factor (GdkWindow *window) { @@ -2268,9 +1941,6 @@ gdk_mir_window_impl_class_init (GdkMirWindowImplClass *klass) impl_class->register_dnd = gdk_mir_window_impl_register_dnd; impl_class->drag_begin = gdk_mir_window_impl_drag_begin; impl_class->process_updates_recurse = gdk_mir_window_impl_process_updates_recurse; - impl_class->get_property = gdk_mir_window_impl_get_property; - impl_class->change_property = gdk_mir_window_impl_change_property; - impl_class->delete_property = gdk_mir_window_impl_delete_property; impl_class->get_scale_factor = gdk_mir_window_impl_get_scale_factor; impl_class->set_opaque_region = gdk_mir_window_impl_set_opaque_region; impl_class->set_shadow_width = gdk_mir_window_impl_set_shadow_width; diff --git a/gdk/quartz/gdkproperty-quartz.c b/gdk/quartz/gdkproperty-quartz.c deleted file mode 100644 index ae66342105..0000000000 --- a/gdk/quartz/gdkproperty-quartz.c +++ /dev/null @@ -1,184 +0,0 @@ -/* gdkproperty-quartz.c - * - * Copyright (C) 2005 Imendio AB - * - * 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, see . - */ - -#include "config.h" - -#include "gdkproperty.h" - -static GHashTable *names_to_atoms; -static GPtrArray *atoms_to_names; - -static const gchar xatoms_string[] = - /* These are all the standard predefined X atoms */ - "NONE\0" - "PRIMARY\0" - "SECONDARY\0" - "ARC\0" - "ATOM\0" - "BITMAP\0" - "CARDINAL\0" - "COLORMAP\0" - "CURSOR\0" - "CUT_BUFFER0\0" - "CUT_BUFFER1\0" - "CUT_BUFFER2\0" - "CUT_BUFFER3\0" - "CUT_BUFFER4\0" - "CUT_BUFFER5\0" - "CUT_BUFFER6\0" - "CUT_BUFFER7\0" - "DRAWABLE\0" - "FONT\0" - "INTEGER\0" - "PIXMAP\0" - "POINT\0" - "RECTANGLE\0" - "RESOURCE_MANAGER\0" - "RGB_COLOR_MAP\0" - "RGB_BEST_MAP\0" - "RGB_BLUE_MAP\0" - "RGB_DEFAULT_MAP\0" - "RGB_GRAY_MAP\0" - "RGB_GREEN_MAP\0" - "RGB_RED_MAP\0" - "STRING\0" - "VISUALID\0" - "WINDOW\0" - "WM_COMMAND\0" - "WM_HINTS\0" - "WM_CLIENT_MACHINE\0" - "WM_ICON_NAME\0" - "WM_ICON_SIZE\0" - "WM_NAME\0" - "WM_NORMAL_HINTS\0" - "WM_SIZE_HINTS\0" - "WM_ZOOM_HINTS\0" - "MIN_SPACE\0" - "NORM_SPACE\0" - "MAX_SPACE\0" - "END_SPACE\0" - "SUPERSCRIPT_X\0" - "SUPERSCRIPT_Y\0" - "SUBSCRIPT_X\0" - "SUBSCRIPT_Y\0" - "UNDERLINE_POSITION\0" - "UNDERLINE_THICKNESS\0" - "STRIKEOUT_ASCENT\0" - "STRIKEOUT_DESCENT\0" - "ITALIC_ANGLE\0" - "X_HEIGHT\0" - "QUAD_WIDTH\0" - "WEIGHT\0" - "POINT_SIZE\0" - "RESOLUTION\0" - "COPYRIGHT\0" - "NOTICE\0" - "FONT_NAME\0" - "FAMILY_NAME\0" - "FULL_NAME\0" - "CAP_HEIGHT\0" - "WM_CLASS\0" - "WM_TRANSIENT_FOR\0" - /* Below here, these are our additions. Increment N_CUSTOM_PREDEFINED - * if you add any. - */ - "CLIPBOARD\0" /* = 69 */; - -static const gint xatoms_offset[] = { - 0, 5, 13, 23, 27, 32, 39, 48, 57, 64, 76, 88, - 100, 112, 124, 136, 148, 160, 169, 174, 182, 189, 195, 205, - 222, 236, 249, 262, 278, 291, 305, 317, 324, 333, 340, 351, - 360, 378, 391, 404, 412, 428, 442, 456, 466, 477, 487, 497, - 511, 525, 537, 549, 568, 588, 605, 623, 636, 645, 656, 663, - 674, 685, 695, 702, 712, 724, 734, 745, 754, 771 -}; - -#define N_CUSTOM_PREDEFINED 1 - -static void -ensure_atom_tables (void) -{ - int i; - - if (names_to_atoms) - return; - - names_to_atoms = g_hash_table_new (g_str_hash, g_str_equal); - atoms_to_names = g_ptr_array_sized_new (G_N_ELEMENTS (xatoms_offset)); - - for (i = 0; i < G_N_ELEMENTS (xatoms_offset); i++) - { - g_hash_table_insert(names_to_atoms, (gchar *)xatoms_string + xatoms_offset[i], GINT_TO_POINTER (i)); - g_ptr_array_add(atoms_to_names, (gchar *)xatoms_string + xatoms_offset[i]); - } -} - -static GdkAtom -intern_atom_internal (const gchar *atom_name, gboolean allocate) -{ - gpointer result; - gchar *name; - g_return_val_if_fail (atom_name != NULL, NULL); - - ensure_atom_tables (); - - if (g_hash_table_lookup_extended (names_to_atoms, atom_name, NULL, &result)) - return result; - - result = GINT_TO_POINTER (atoms_to_names->len); - name = allocate ? g_strdup (atom_name) : (gchar *)atom_name; - g_hash_table_insert(names_to_atoms, name, result); - g_ptr_array_add(atoms_to_names, name); - - return result; -} - -void -_gdk_quartz_window_delete_property (GdkWindow *window, - GdkAtom property) -{ - /* FIXME: Implement */ -} - -gint -_gdk_quartz_window_get_property (GdkWindow *window, - GdkAtom property, - GdkAtom type, - gulong offset, - gulong length, - gint pdelete, - GdkAtom *actual_property_type, - gint *actual_format_type, - gint *actual_length, - guchar **data) -{ - /* FIXME: Implement */ - return 0; -} - -void -_gdk_quartz_window_change_property (GdkWindow *window, - GdkAtom property, - GdkAtom type, - gint format, - GdkPropMode mode, - const guchar *data, - gint nelements) -{ - /* FIXME: Implement */ -} diff --git a/gdk/quartz/gdkwindow-quartz.c b/gdk/quartz/gdkwindow-quartz.c index 1d5982be5f..d105612199 100644 --- a/gdk/quartz/gdkwindow-quartz.c +++ b/gdk/quartz/gdkwindow-quartz.c @@ -2811,9 +2811,6 @@ gdk_window_impl_quartz_class_init (GdkWindowImplQuartzClass *klass) impl_class->register_dnd = _gdk_quartz_window_register_dnd; impl_class->drag_begin = _gdk_quartz_window_drag_begin; impl_class->process_updates_recurse = _gdk_quartz_window_process_updates_recurse; - impl_class->get_property = _gdk_quartz_window_get_property; - impl_class->change_property = _gdk_quartz_window_change_property; - impl_class->delete_property = _gdk_quartz_window_delete_property; impl_class->create_gl_context = gdk_quartz_window_create_gl_context; diff --git a/gdk/quartz/meson.build b/gdk/quartz/meson.build index 0b01964b3f..acacd791a8 100644 --- a/gdk/quartz/meson.build +++ b/gdk/quartz/meson.build @@ -13,7 +13,6 @@ gdk_quartz_sources = files([ 'gdkglcontext-quartz.c', 'gdkglobals-quartz.c', 'gdkkeys-quartz.c', - 'gdkproperty-quartz.c', 'gdkscreen-quartz.c', 'gdkselection-quartz.c', 'gdkutils-quartz.c', diff --git a/gdk/wayland/gdkprivate-wayland.h b/gdk/wayland/gdkprivate-wayland.h index b35a02fb7a..afd2a2bfd0 100644 --- a/gdk/wayland/gdkprivate-wayland.h +++ b/gdk/wayland/gdkprivate-wayland.h @@ -129,22 +129,6 @@ void _gdk_wayland_display_create_window_impl (GdkDisplay *display, GdkEventMask event_mask, GdkWindowAttr *attributes); -void _gdk_wayland_display_send_selection_notify (GdkDisplay *dispay, - GdkWindow *requestor, - GdkAtom selection, - GdkAtom target, - GdkAtom property, - guint32 time); -gint _gdk_wayland_display_get_selection_property (GdkDisplay *display, - GdkWindow *requestor, - guchar **data, - GdkAtom *ret_type, - gint *ret_format); -void _gdk_wayland_display_convert_selection (GdkDisplay *display, - GdkWindow *requestor, - GdkAtom selection, - GdkAtom target, - guint32 time); gint _gdk_wayland_display_text_property_to_utf8_list (GdkDisplay *display, GdkAtom encoding, gint format, @@ -224,11 +208,6 @@ gpointer gdk_wayland_selection_get_offer (GdkDisplay *display, GdkContentFormats *gdk_wayland_selection_get_targets (GdkDisplay *display, GdkAtom selection); -void gdk_wayland_selection_store (GdkWindow *window, - GdkAtom type, - GdkPropMode mode, - const guchar *data, - gint len); struct wl_data_source * gdk_wayland_selection_get_data_source (GdkWindow *owner, GdkAtom selection); void gdk_wayland_selection_unset_data_source (GdkDisplay *display, GdkAtom selection); diff --git a/gdk/wayland/gdkselection-wayland.c b/gdk/wayland/gdkselection-wayland.c index caec000bb3..97482af55c 100644 --- a/gdk/wayland/gdkselection-wayland.c +++ b/gdk/wayland/gdkselection-wayland.c @@ -36,7 +36,6 @@ typedef struct _SelectionBuffer SelectionBuffer; typedef struct _SelectionData SelectionData; typedef struct _StoredSelection StoredSelection; -typedef struct _AsyncWriteData AsyncWriteData; typedef struct _DataOfferData DataOfferData; struct _SelectionBuffer @@ -67,13 +66,6 @@ struct _DataOfferData GdkContentFormats *targets; }; -struct _AsyncWriteData -{ - GOutputStream *stream; - GdkWaylandSelection *selection; - gsize index; -}; - struct _SelectionData { DataOfferData *offer; @@ -98,14 +90,6 @@ struct _GdkWaylandSelection struct wl_data_source *dnd_source; /* Owned by the GdkDragContext */ }; -static void async_write_data_write (AsyncWriteData *write_data); - -static inline glong -get_buffer_size (void) -{ - return sysconf (_SC_PAGESIZE); -} - static DataOfferData * data_offer_data_new (gpointer offer, GDestroyNotify destroy_notify) @@ -362,161 +346,6 @@ gdk_wayland_selection_get_targets (GdkDisplay *display, return NULL; } -static AsyncWriteData * -async_write_data_new (GdkWaylandSelection *selection) -{ - AsyncWriteData *write_data; - - write_data = g_slice_new0 (AsyncWriteData); - write_data->selection = selection; - write_data->stream = - g_unix_output_stream_new (selection->stored_selection.fd, TRUE); - - selection->stored_selection.fd = -1; - - return write_data; -} - -static void -async_write_data_free (AsyncWriteData *write_data) -{ - g_object_unref (write_data->stream); - g_slice_free (AsyncWriteData, write_data); -} - -static void -async_write_data_cb (GObject *object, - GAsyncResult *res, - gpointer user_data) -{ - AsyncWriteData *write_data = user_data; - GError *error = NULL; - gsize bytes_written; - - bytes_written = g_output_stream_write_finish (G_OUTPUT_STREAM (object), - res, &error); - if (error) - { - if (error->domain != G_IO_ERROR || - error->code != G_IO_ERROR_CANCELLED) - g_warning ("Error writing selection data: %s", error->message); - - g_error_free (error); - async_write_data_free (write_data); - return; - } - - write_data->index += bytes_written; - - if (write_data->index < - write_data->selection->stored_selection.data_len) - { - /* Write the next chunk */ - async_write_data_write (write_data); - } - else - async_write_data_free (write_data); -} - -static void -async_write_data_write (AsyncWriteData *write_data) -{ - GdkWaylandSelection *selection = write_data->selection; - gsize buf_len; - guchar *buf; - - buf = selection->stored_selection.data; - buf_len = selection->stored_selection.data_len; - - g_output_stream_write_async (write_data->stream, - &buf[write_data->index], - buf_len - write_data->index, - G_PRIORITY_DEFAULT, - selection->stored_selection.cancellable, - async_write_data_cb, - write_data); -} - -static gboolean -gdk_wayland_selection_check_write (GdkWaylandSelection *selection) -{ - AsyncWriteData *write_data; - - if (selection->stored_selection.fd < 0) - return FALSE; - - /* Cancel any previous ongoing async write */ - if (selection->stored_selection.cancellable) - { - g_cancellable_cancel (selection->stored_selection.cancellable); - g_object_unref (selection->stored_selection.cancellable); - } - - selection->stored_selection.cancellable = g_cancellable_new (); - - write_data = async_write_data_new (selection); - async_write_data_write (write_data); - selection->stored_selection.fd = -1; - - return TRUE; -} - -void -gdk_wayland_selection_store (GdkWindow *window, - GdkAtom type, - GdkPropMode mode, - const guchar *data, - gint len) -{ - GdkDisplay *display = gdk_window_get_display (window); - GdkWaylandSelection *selection = gdk_wayland_display_get_selection (display); - GArray *array; - - if (type == gdk_atom_intern_static_string ("NULL")) - return; - - array = g_array_new (TRUE, FALSE, sizeof (guchar)); - g_array_append_vals (array, data, len); - - if (selection->stored_selection.data) - { - if (mode != GDK_PROP_MODE_REPLACE && - type != selection->stored_selection.type) - { - gchar *type_str, *stored_str; - - type_str = gdk_atom_name (type); - stored_str = gdk_atom_name (selection->stored_selection.type); - - g_warning (G_STRLOC ": Attempted to append/prepend selection data with " - "type %s into the current selection with type %s", - type_str, stored_str); - g_free (type_str); - g_free (stored_str); - return; - } - - /* In these cases we also replace the stored data, so we - * apply the inverse operation into the just given data. - */ - if (mode == GDK_PROP_MODE_APPEND) - g_array_prepend_vals (array, selection->stored_selection.data, - selection->stored_selection.data_len - 1); - else if (mode == GDK_PROP_MODE_PREPEND) - g_array_append_vals (array, selection->stored_selection.data, - selection->stored_selection.data_len - 1); - - g_free (selection->stored_selection.data); - } - - selection->stored_selection.source = window; - selection->stored_selection.data_len = array->len; - selection->stored_selection.data = (guchar *) g_array_free (array, FALSE); - selection->stored_selection.type = type; - - gdk_wayland_selection_check_write (selection); -} - static void data_source_target (void *data, struct wl_data_source *source, diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c index d6281cd339..60a56a0597 100644 --- a/gdk/wayland/gdkwindow-wayland.c +++ b/gdk/wayland/gdkwindow-wayland.c @@ -3507,40 +3507,6 @@ gdk_wayland_window_destroy_notify (GdkWindow *window) g_object_unref (window); } -static gboolean -gdk_wayland_window_get_property (GdkWindow *window, - GdkAtom property, - GdkAtom type, - gulong offset, - gulong length, - gint pdelete, - GdkAtom *actual_property_type, - gint *actual_format_type, - gint *actual_length, - guchar **data) -{ - return FALSE; -} - -static void -gdk_wayland_window_change_property (GdkWindow *window, - GdkAtom property, - GdkAtom type, - gint format, - GdkPropMode mode, - const guchar *data, - gint nelements) -{ - if (property == gdk_atom_intern_static_string ("GDK_SELECTION")) - gdk_wayland_selection_store (window, type, mode, data, nelements * (format / 8)); -} - -static void -gdk_wayland_window_delete_property (GdkWindow *window, - GdkAtom property) -{ -} - static gint gdk_wayland_window_get_scale_factor (GdkWindow *window) { @@ -3707,9 +3673,6 @@ _gdk_window_impl_wayland_class_init (GdkWindowImplWaylandClass *klass) impl_class->destroy_notify = gdk_wayland_window_destroy_notify; impl_class->register_dnd = _gdk_wayland_window_register_dnd; impl_class->drag_begin = _gdk_wayland_window_drag_begin; - impl_class->get_property = gdk_wayland_window_get_property; - impl_class->change_property = gdk_wayland_window_change_property; - impl_class->delete_property = gdk_wayland_window_delete_property; impl_class->get_scale_factor = gdk_wayland_window_get_scale_factor; impl_class->set_opaque_region = gdk_wayland_window_set_opaque_region; impl_class->set_shadow_width = gdk_wayland_window_set_shadow_width; diff --git a/gdk/win32/gdkprivate-win32.h b/gdk/win32/gdkprivate-win32.h index e5016b078a..75c1bec656 100644 --- a/gdk/win32/gdkprivate-win32.h +++ b/gdk/win32/gdkprivate-win32.h @@ -426,28 +426,6 @@ GdkDragContext *_gdk_win32_window_drag_begin (GdkWindow *window, gint x_root, gint y_root); -gint _gdk_win32_window_get_property (GdkWindow *window, - GdkAtom property, - GdkAtom type, - gulong offset, - gulong length, - gint pdelete, - GdkAtom *actual_property_type, - gint *actual_format_type, - gint *actual_length, - guchar **data); -void _gdk_win32_window_change_property (GdkWindow *window, - GdkAtom property, - GdkAtom type, - gint format, - GdkPropMode mode, - const guchar *data, - gint nelements); -void _gdk_win32_window_delete_property (GdkWindow *window, GdkAtom property); - -void gdk_win32_selection_clear_targets (GdkDisplay *display, - GdkAtom selection); - /* Stray GdkWin32Screen members */ gboolean _gdk_win32_get_setting (const gchar *name, GValue *value); void _gdk_win32_screen_on_displaychange_event (GdkWin32Screen *screen); diff --git a/gdk/win32/gdkproperty-win32.c b/gdk/win32/gdkproperty-win32.c index 4692df5dfc..6b37920858 100644 --- a/gdk/win32/gdkproperty-win32.c +++ b/gdk/win32/gdkproperty-win32.c @@ -77,133 +77,6 @@ _gdk_win32_display_manager_get_atom_name (GdkDisplayManager *manager, return g_strdup (name); } -gint -_gdk_win32_window_get_property (GdkWindow *window, - GdkAtom property, - GdkAtom type, - gulong offset, - gulong length, - gint pdelete, - GdkAtom *actual_property_type, - gint *actual_format_type, - gint *actual_length, - guchar **data) -{ - g_return_val_if_fail (window != NULL, FALSE); - g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE); - - if (GDK_WINDOW_DESTROYED (window)) - return FALSE; - - g_warning ("gdk_property_get: Not implemented"); - - return FALSE; -} - -void -_gdk_win32_window_change_property (GdkWindow *window, - GdkAtom property, - GdkAtom type, - gint format, - GdkPropMode mode, - const guchar *data, - gint nelements) -{ - GdkWin32Selection *win32_sel = _gdk_win32_selection_get (); - - g_return_if_fail (window != NULL); - g_return_if_fail (GDK_IS_WINDOW (window)); - - if (GDK_WINDOW_DESTROYED (window)) - return; - - GDK_NOTE (DND, { - gchar *prop_name = gdk_atom_name (property); - gchar *type_name = gdk_atom_name (type); - gchar *datastring = _gdk_win32_data_to_string (data, MIN (10, format*nelements/8)); - - g_print ("gdk_property_change: %p %s %s %s %d*%d bits: %s\n", - GDK_WINDOW_HWND (window), - prop_name, - type_name, - (mode == GDK_PROP_MODE_REPLACE ? "REPLACE" : - (mode == GDK_PROP_MODE_PREPEND ? "PREPEND" : - (mode == GDK_PROP_MODE_APPEND ? "APPEND" : - "???"))), - format, nelements, - datastring); - g_free (datastring); - g_free (prop_name); - g_free (type_name); - }); - -#ifndef G_DISABLE_CHECKS - /* We should never come here for these types */ - if (G_UNLIKELY (type == _gdk_win32_selection_atom (GDK_WIN32_ATOM_INDEX_COMPOUND_TEXT) || - type == _gdk_win32_selection_atom (GDK_WIN32_ATOM_INDEX_SAVE_TARGETS))) - { - g_return_if_fail_warning (G_LOG_DOMAIN, - G_STRFUNC, - "change_property called with a bad type"); - return; - } -#endif - - if (property == _gdk_win32_selection_atom (GDK_WIN32_ATOM_INDEX_GDK_SELECTION) || - property == _gdk_win32_selection_atom (GDK_WIN32_ATOM_INDEX_OLE2_DND)) - { - _gdk_win32_selection_property_change (win32_sel, - window, - property, - type, - format, - mode, - data, - nelements); - } - else - g_warning ("gdk_property_change: General case not implemented"); -} - -void -_gdk_win32_window_delete_property (GdkWindow *window, - GdkAtom property) -{ - gchar *prop_name; - - g_return_if_fail (window != NULL); - g_return_if_fail (GDK_IS_WINDOW (window)); - - GDK_NOTE (DND, { - prop_name = gdk_atom_name (property); - - g_print ("gdk_property_delete: %p %s\n", - GDK_WINDOW_HWND (window), - prop_name); - g_free (prop_name); - }); - - if (property == _gdk_win32_selection_atom (GDK_WIN32_ATOM_INDEX_GDK_SELECTION) || - property == _gdk_win32_selection_atom (GDK_WIN32_ATOM_INDEX_OLE2_DND)) - _gdk_selection_property_delete (window); -/* - else if (property == _gdk_win32_selection_atom (GDK_WIN32_ATOM_INDEX_WM_TRANSIENT_FOR)) - { - GdkScreen *screen; - - screen = gdk_window_get_screen (window); - gdk_window_set_transient_for (window, NULL); - } -*/ - else - { - prop_name = gdk_atom_name (property); - g_warning ("gdk_property_delete: General case (%s) not implemented", - prop_name); - g_free (prop_name); - } -} - /* For reference, from gdk/x11/gdksettings.c: diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c index 3756fb4062..12b8aa623c 100644 --- a/gdk/win32/gdkwindow-win32.c +++ b/gdk/win32/gdkwindow-win32.c @@ -5941,9 +5941,6 @@ gdk_window_impl_win32_class_init (GdkWindowImplWin32Class *klass) impl_class->destroy_notify = gdk_win32_window_destroy_notify; impl_class->register_dnd = _gdk_win32_window_register_dnd; impl_class->drag_begin = _gdk_win32_window_drag_begin; - impl_class->get_property = _gdk_win32_window_get_property; - impl_class->change_property = _gdk_win32_window_change_property; - impl_class->delete_property = _gdk_win32_window_delete_property; impl_class->create_gl_context = _gdk_win32_window_create_gl_context; impl_class->get_scale_factor = _gdk_win32_window_get_scale_factor; impl_class->get_unscaled_size = _gdk_win32_window_get_unscaled_size; diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c index 9dbbfafb97..cb5d6a229c 100644 --- a/gdk/x11/gdkdisplay-x11.c +++ b/gdk/x11/gdkdisplay-x11.c @@ -1038,17 +1038,7 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator, gdk_check_edge_constraints_changed (window); } - if (window->event_mask & GDK_PROPERTY_CHANGE_MASK) - { - event->any.type = GDK_PROPERTY_NOTIFY; - event->any.window = window; - event->property.atom = gdk_x11_xatom_to_atom_for_display (display, xevent->xproperty.atom); - event->property.time = xevent->xproperty.time; - event->property.state = xevent->xproperty.state; - } - else - return_val = FALSE; - + return_val = FALSE; break; case ColormapNotify: diff --git a/gdk/x11/gdkprivate-x11.h b/gdk/x11/gdkprivate-x11.h index 597e6b8fcd..2cc7d7cf5a 100644 --- a/gdk/x11/gdkprivate-x11.h +++ b/gdk/x11/gdkprivate-x11.h @@ -73,26 +73,6 @@ void _gdk_x11_window_process_expose (GdkWindow *window, gulong serial, GdkRectangle *area); -gboolean _gdk_x11_window_get_property (GdkWindow *window, - GdkAtom property, - GdkAtom type, - gulong offset, - gulong length, - gint pdelete, - GdkAtom *actual_property_type, - gint *actual_format_type, - gint *actual_length, - guchar **data); -void _gdk_x11_window_change_property (GdkWindow *window, - GdkAtom property, - GdkAtom type, - gint format, - GdkPropMode mode, - const guchar *data, - gint nelements); -void _gdk_x11_window_delete_property (GdkWindow *window, - GdkAtom property); - void _gdk_x11_window_queue_antiexpose (GdkWindow *window, cairo_region_t *area); void _gdk_x11_window_translate (GdkWindow *window, diff --git a/gdk/x11/gdkproperty-x11.c b/gdk/x11/gdkproperty-x11.c index 863cd8556c..3894dfab4e 100644 --- a/gdk/x11/gdkproperty-x11.c +++ b/gdk/x11/gdkproperty-x11.c @@ -338,227 +338,3 @@ gdk_x11_get_xatom_name (Atom xatom) return _gdk_atom_name_const (gdk_x11_xatom_to_atom (xatom)); } -gboolean -_gdk_x11_window_get_property (GdkWindow *window, - GdkAtom property, - GdkAtom type, - gulong offset, - gulong length, - gint pdelete, - GdkAtom *actual_property_type, - gint *actual_format_type, - gint *actual_length, - guchar **data) -{ - GdkDisplay *display; - Atom ret_prop_type; - gint ret_format; - gulong ret_nitems; - gulong ret_bytes_after; - gulong get_length; - gulong ret_length; - guchar *ret_data; - Atom xproperty; - Atom xtype; - int res; - Window xwindow; - - g_return_val_if_fail (!window || GDK_WINDOW_IS_X11 (window), FALSE); - - if (!window) - xwindow = GDK_DISPLAY_XROOTWIN (gdk_display_get_default ()); - else if (!GDK_WINDOW_IS_X11 (window)) - return FALSE; - else if (GDK_WINDOW_DESTROYED (window)) - return FALSE; - else - xwindow = GDK_WINDOW_XID (window); - - display = gdk_window_get_display (window); - xproperty = gdk_x11_atom_to_xatom_for_display (display, property); - if (type == NULL) - xtype = AnyPropertyType; - else - xtype = gdk_x11_atom_to_xatom_for_display (display, type); - - ret_data = NULL; - - /* - * Round up length to next 4 byte value. Some code is in the (bad?) - * habit of passing G_MAXLONG as the length argument, causing an - * overflow to negative on the add. In this case, we clamp the - * value to G_MAXLONG. - */ - get_length = length + 3; - if (get_length > G_MAXLONG) - get_length = G_MAXLONG; - - /* To fail, either the user passed 0 or G_MAXULONG */ - get_length = get_length / 4; - if (get_length == 0) - { - g_warning ("gdk_propery-get(): invalid length 0"); - return FALSE; - } - - res = XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), - xwindow, xproperty, - offset, get_length, pdelete, - xtype, &ret_prop_type, &ret_format, - &ret_nitems, &ret_bytes_after, - &ret_data); - - if (res != Success || (ret_prop_type == None && ret_format == 0)) - { - return FALSE; - } - - if (actual_property_type) - *actual_property_type = gdk_x11_xatom_to_atom_for_display (display, ret_prop_type); - if (actual_format_type) - *actual_format_type = ret_format; - - if ((xtype != AnyPropertyType) && (ret_prop_type != xtype)) - { - XFree (ret_data); - g_warning ("Couldn't match property type %s to %s\n", - gdk_x11_get_xatom_name_for_display (display, ret_prop_type), - gdk_x11_get_xatom_name_for_display (display, xtype)); - return FALSE; - } - - /* FIXME: ignoring bytes_after could have very bad effects */ - - if (data) - { - if (ret_prop_type == XA_ATOM || - ret_prop_type == gdk_x11_get_xatom_by_name_for_display (display, "ATOM_PAIR")) - { - /* - * data is an array of X atom, we need to convert it - * to an array of GDK Atoms - */ - gint i; - GdkAtom *ret_atoms = g_new (GdkAtom, ret_nitems); - Atom *xatoms = (Atom *)ret_data; - - *data = (guchar *)ret_atoms; - - for (i = 0; i < ret_nitems; i++) - ret_atoms[i] = gdk_x11_xatom_to_atom_for_display (display, xatoms[i]); - - if (actual_length) - *actual_length = ret_nitems * sizeof (GdkAtom); - } - else - { - switch (ret_format) - { - case 8: - ret_length = ret_nitems; - break; - case 16: - ret_length = sizeof(short) * ret_nitems; - break; - case 32: - ret_length = sizeof(long) * ret_nitems; - break; - default: - g_warning ("unknown property return format: %d", ret_format); - XFree (ret_data); - return FALSE; - } - - *data = g_new (guchar, ret_length); - memcpy (*data, ret_data, ret_length); - if (actual_length) - *actual_length = ret_length; - } - } - - XFree (ret_data); - - return TRUE; -} - -void -_gdk_x11_window_change_property (GdkWindow *window, - GdkAtom property, - GdkAtom type, - gint format, - GdkPropMode mode, - const guchar *data, - gint nelements) -{ - GdkDisplay *display; - Window xwindow; - Atom xproperty; - Atom xtype; - - g_return_if_fail (!window || GDK_WINDOW_IS_X11 (window)); - - if (!window) - xwindow = GDK_DISPLAY_XROOTWIN (gdk_display_get_default ()); - else if (!GDK_WINDOW_IS_X11 (window)) - return; - else if (GDK_WINDOW_DESTROYED (window)) - return; - else - xwindow = GDK_WINDOW_XID (window); - - if (!gdk_window_has_native (window)) - { - g_warning ("Can't change property on non-native window"); - return; - } - - display = gdk_window_get_display (window); - xproperty = gdk_x11_atom_to_xatom_for_display (display, property); - xtype = gdk_x11_atom_to_xatom_for_display (display, type); - - if (xtype == XA_ATOM || - xtype == gdk_x11_get_xatom_by_name_for_display (display, "ATOM_PAIR")) - { - /* - * data is an array of GdkAtom, we need to convert it - * to an array of X Atoms - */ - gint i; - GdkAtom *atoms = (GdkAtom*) data; - Atom *xatoms; - - xatoms = g_new (Atom, nelements); - for (i = 0; i < nelements; i++) - xatoms[i] = gdk_x11_atom_to_xatom_for_display (display, atoms[i]); - - XChangeProperty (GDK_DISPLAY_XDISPLAY (display), xwindow, - xproperty, xtype, - format, mode, (guchar *)xatoms, nelements); - g_free (xatoms); - } - else - XChangeProperty (GDK_DISPLAY_XDISPLAY (display), xwindow, xproperty, - xtype, format, mode, (guchar *)data, nelements); -} - -void -_gdk_x11_window_delete_property (GdkWindow *window, - GdkAtom property) -{ - Window xwindow; - - g_return_if_fail (!window || GDK_WINDOW_IS_X11 (window)); - - if (!window) - xwindow = GDK_DISPLAY_XROOTWIN (gdk_display_get_default ()); - else if (!GDK_WINDOW_IS_X11 (window)) - return; - else if (GDK_WINDOW_DESTROYED (window)) - return; - else - xwindow = GDK_WINDOW_XID (window); - - XDeleteProperty (GDK_WINDOW_XDISPLAY (window), xwindow, - gdk_x11_atom_to_xatom_for_display (GDK_WINDOW_DISPLAY (window), - property)); -} diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c index d56c9bdf0e..9fae7dc4a9 100644 --- a/gdk/x11/gdkwindow-x11.c +++ b/gdk/x11/gdkwindow-x11.c @@ -4975,9 +4975,6 @@ gdk_window_impl_x11_class_init (GdkWindowImplX11Class *klass) impl_class->destroy_notify = gdk_x11_window_destroy_notify; impl_class->register_dnd = _gdk_x11_window_register_dnd; impl_class->drag_begin = _gdk_x11_window_drag_begin; - impl_class->get_property = _gdk_x11_window_get_property; - impl_class->change_property = _gdk_x11_window_change_property; - impl_class->delete_property = _gdk_x11_window_delete_property; impl_class->get_scale_factor = gdk_x11_window_get_scale_factor; impl_class->set_opaque_region = gdk_x11_window_set_opaque_region; impl_class->set_shadow_width = gdk_x11_window_set_shadow_width; diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c index 2e1a0223ef..0a5e6ff98a 100644 --- a/gtk/gtkmain.c +++ b/gtk/gtkmain.c @@ -1806,7 +1806,6 @@ gtk_main_do_event (GdkEvent *event) gtk_widget_render (event_widget, event->any.window, event->expose.region); break; - case GDK_PROPERTY_NOTIFY: case GDK_FOCUS_CHANGE: case GDK_CONFIGURE: case GDK_MAP: diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index c5dc3a44ad..a6206e390b 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -520,7 +520,6 @@ enum { FOCUS_OUT_EVENT, MAP_EVENT, UNMAP_EVENT, - PROPERTY_NOTIFY_EVENT, SELECTION_GET, SELECTION_RECEIVED, PROXIMITY_IN_EVENT, @@ -1044,7 +1043,6 @@ gtk_widget_class_init (GtkWidgetClass *klass) klass->map_event = NULL; klass->unmap_event = NULL; klass->window_state_event = NULL; - klass->property_notify_event = NULL; klass->selection_received = NULL; klass->proximity_in_event = NULL; klass->proximity_out_event = NULL; @@ -2400,33 +2398,6 @@ gtk_widget_class_init (GtkWidgetClass *klass) g_signal_set_va_marshaller (widget_signals[UNMAP_EVENT], G_TYPE_FROM_CLASS (klass), _gtk_marshal_BOOLEAN__OBJECTv); - /** - * GtkWidget::property-notify-event: - * @widget: the object which received the signal - * @event: (type Gdk.EventProperty): the #GdkEventProperty which triggered - * this signal. - * - * The ::property-notify-event signal will be emitted when a property on - * the @widget's window has been changed or deleted. - * - * To receive this signal, the #GdkWindow associated to the widget needs - * to enable the #GDK_PROPERTY_CHANGE_MASK mask. - * - * Returns: %TRUE to stop other handlers from being invoked for the event. - * %FALSE to propagate the event further. - */ - widget_signals[PROPERTY_NOTIFY_EVENT] = - g_signal_new (I_("property-notify-event"), - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST | G_SIGNAL_DEPRECATED, - G_STRUCT_OFFSET (GtkWidgetClass, property_notify_event), - _gtk_boolean_handled_accumulator, NULL, - _gtk_marshal_BOOLEAN__OBJECT, - G_TYPE_BOOLEAN, 1, - GDK_TYPE_EVENT); - g_signal_set_va_marshaller (widget_signals[PROPERTY_NOTIFY_EVENT], G_TYPE_FROM_CLASS (klass), - _gtk_marshal_BOOLEAN__OBJECTv); - /** * GtkWidget::selection-received: * @widget: the object which received the signal. @@ -6601,7 +6572,6 @@ gtk_widget_event_internal (GtkWidget *widget, case GDK_MAP: case GDK_UNMAP: case GDK_WINDOW_STATE: - case GDK_PROPERTY_NOTIFY: return gtk_widget_emit_event_signals (widget, event); default: break; @@ -6718,9 +6688,6 @@ gtk_widget_emit_event_signals (GtkWidget *widget, case GDK_WINDOW_STATE: signal_num = WINDOW_STATE_EVENT; break; - case GDK_PROPERTY_NOTIFY: - signal_num = PROPERTY_NOTIFY_EVENT; - break; case GDK_PROXIMITY_IN: signal_num = PROXIMITY_IN_EVENT; break; diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h index 9ad1a8e62a..50d3b9ebb8 100644 --- a/gtk/gtkwidget.h +++ b/gtk/gtkwidget.h @@ -367,8 +367,6 @@ struct _GtkWidgetClass GdkEventAny *event); gboolean (* unmap_event) (GtkWidget *widget, GdkEventAny *event); - gboolean (* property_notify_event) (GtkWidget *widget, - GdkEventProperty *event); gboolean (* proximity_in_event) (GtkWidget *widget, GdkEventProximity *event); gboolean (* proximity_out_event) (GtkWidget *widget,