diff options
author | Debarshi Ray <debarshir@gnome.org> | 2017-04-21 18:57:49 +0200 |
---|---|---|
committer | Debarshi Ray <debarshir@gnome.org> | 2017-04-25 11:17:01 +0200 |
commit | 63d1488b3bcea686e85dd7273365861eacbe8442 (patch) | |
tree | b6213d75f69c0df1ac8542e3e32519463232aae2 | |
parent | cc90107531640bcba6c3c58e5cf6aec94d498763 (diff) | |
download | libgd-63d1488b3bcea686e85dd7273365861eacbe8442.tar.gz |
Remove gd_entry_focus_hack
One can use gtk_entry_grab_focus_without_selecting these days.
https://bugzilla.gnome.org/show_bug.cgi?id=781672
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | libgd/gd-entry-focus-hack.c | 89 | ||||
-rw-r--r-- | libgd/gd-entry-focus-hack.h | 30 | ||||
-rw-r--r-- | libgd/gd.h | 1 | ||||
-rw-r--r-- | libgd/meson.build | 2 |
5 files changed, 0 insertions, 124 deletions
diff --git a/Makefile.am b/Makefile.am index 22ea01d..93dce97 100644 --- a/Makefile.am +++ b/Makefile.am @@ -37,8 +37,6 @@ EXTRA_DIST += $(catalog_sources) if LIBGD_GTK_HACKS gtk_hacks_sources = \ - libgd/gd-entry-focus-hack.c \ - libgd/gd-entry-focus-hack.h \ libgd/gd-icon-utils.c \ libgd/gd-icon-utils.h \ $(NULL) diff --git a/libgd/gd-entry-focus-hack.c b/libgd/gd-entry-focus-hack.c deleted file mode 100644 index 8f2860e..0000000 --- a/libgd/gd-entry-focus-hack.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2011, 2012 Red Hat, Inc. - * - * Gnome Documents is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * Gnome Documents 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 General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with Gnome Documents; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author: Cosimo Cecchi <cosimoc@redhat.com> - * - */ - -#include "gd-entry-focus-hack.h" - -/* taken from gtk/gtktreeview.c */ -static void -send_focus_change (GtkWidget *widget, - GdkDevice *device, - gboolean in) -{ - GdkDeviceManager *device_manager; - GList *devices, *d; - - device_manager = gdk_display_get_device_manager (gtk_widget_get_display (widget)); - devices = gdk_device_manager_list_devices (device_manager, GDK_DEVICE_TYPE_MASTER); - devices = g_list_concat (devices, gdk_device_manager_list_devices (device_manager, GDK_DEVICE_TYPE_SLAVE)); - devices = g_list_concat (devices, gdk_device_manager_list_devices (device_manager, GDK_DEVICE_TYPE_FLOATING)); - - for (d = devices; d; d = d->next) - { - GdkDevice *dev = d->data; - GdkEvent *fevent; - GdkWindow *window; - - if (gdk_device_get_source (dev) != GDK_SOURCE_KEYBOARD) - continue; - - window = gtk_widget_get_window (widget); - if (!window) - continue; - - /* Skip non-master keyboards that haven't - * selected for events from this window - */ - if (gdk_device_get_device_type (dev) != GDK_DEVICE_TYPE_MASTER && - !gdk_window_get_device_events (window, dev)) - continue; - - fevent = gdk_event_new (GDK_FOCUS_CHANGE); - - fevent->focus_change.type = GDK_FOCUS_CHANGE; - fevent->focus_change.window = g_object_ref (window); - fevent->focus_change.in = in; - gdk_event_set_device (fevent, device); - - gtk_widget_send_focus_change (widget, fevent); - - gdk_event_free (fevent); - } - - g_list_free (devices); -} - -void -gd_entry_focus_hack (GtkWidget *entry, - GdkDevice *device) -{ - GtkEntryClass *entry_class; - GtkWidgetClass *entry_parent_class; - - /* Grab focus will select all the text. We don't want that to happen, so we - * call the parent instance and bypass the selection change. This is probably - * really non-kosher. */ - entry_class = g_type_class_peek (GTK_TYPE_ENTRY); - entry_parent_class = g_type_class_peek_parent (entry_class); - (entry_parent_class->grab_focus) (entry); - - /* send focus-in event */ - send_focus_change (entry, device, TRUE); -} diff --git a/libgd/gd-entry-focus-hack.h b/libgd/gd-entry-focus-hack.h deleted file mode 100644 index 8daa559..0000000 --- a/libgd/gd-entry-focus-hack.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2011, 2012 Red Hat, Inc. - * - * Gnome Documents is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * Gnome Documents 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 General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with Gnome Documents; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author: Cosimo Cecchi <cosimoc@redhat.com> - * - */ - -#ifndef __GD_ENTRY_FOCUS_HACK_H__ -#define __GD_ENTRY_FOCUS_HACK_H__ - -#include <gtk/gtk.h> - -void gd_entry_focus_hack (GtkWidget *entry, - GdkDevice *device); - -#endif/* __GD_ENTRY_FOCUS_HACK_H__ */ @@ -32,7 +32,6 @@ G_BEGIN_DECLS #ifdef LIBGD_GTK_HACKS # include <libgd/gd-icon-utils.h> -# include <libgd/gd-entry-focus-hack.h> #endif #ifdef LIBGD__BOX_COMMON diff --git a/libgd/meson.build b/libgd/meson.build index abe8985..bc71abc 100644 --- a/libgd/meson.build +++ b/libgd/meson.build @@ -13,8 +13,6 @@ private_c_args = [ if get_option('with-gtk-hacks') sources += [ - 'gd-entry-focus-hack.c', - 'gd-entry-focus-hack.h', 'gd-icon-utils.c', 'gd-icon-utils.h', ] |