forked from AuroraMiddleware/gtk
Revert "gtkcellrendereraccel: Use a GtkInvisible to grab on"
This reverts commit fe5402d32e
.
This commit is contained in:
parent
4cec291ab0
commit
fe11f8f875
@ -27,9 +27,9 @@
|
||||
#include "gtkmain.h"
|
||||
#include "gtksizerequest.h"
|
||||
#include "gtktypebuiltins.h"
|
||||
#include "gtkinvisible.h"
|
||||
#include "gtkprivate.h"
|
||||
|
||||
|
||||
/**
|
||||
* SECTION:gtkcellrendereraccel
|
||||
* @Short_description: Renders a keyboard accelerator in a cell
|
||||
@ -88,9 +88,9 @@ enum {
|
||||
struct _GtkCellRendererAccelPrivate
|
||||
{
|
||||
GtkWidget *edit_widget;
|
||||
GtkWidget *grab_widget;
|
||||
GtkWidget *sizing_label;
|
||||
|
||||
GtkWidget *grab_invisible;
|
||||
GdkDevice *grab_keyboard;
|
||||
GdkDevice *grab_pointer;
|
||||
|
||||
@ -526,6 +526,7 @@ grab_key_callback (GtkWidget *widget,
|
||||
gtk_cell_editable_editing_done (GTK_CELL_EDITABLE (priv->edit_widget));
|
||||
gtk_cell_editable_remove_widget (GTK_CELL_EDITABLE (priv->edit_widget));
|
||||
priv->edit_widget = NULL;
|
||||
priv->grab_widget = NULL;
|
||||
priv->grab_keyboard = NULL;
|
||||
priv->grab_pointer = NULL;
|
||||
|
||||
@ -552,8 +553,9 @@ ungrab_stuff (GtkWidget *widget,
|
||||
priv->grab_keyboard = NULL;
|
||||
priv->grab_pointer = NULL;
|
||||
|
||||
gtk_widget_destroy (priv->grab_invisible);
|
||||
priv->grab_invisible = NULL;
|
||||
g_signal_handlers_disconnect_by_func (priv->grab_widget,
|
||||
G_CALLBACK (grab_key_callback),
|
||||
accel);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -662,6 +664,7 @@ gtk_cell_renderer_accel_start_editing (GtkCellRenderer *cell,
|
||||
GtkWidget *label;
|
||||
GtkWidget *eventbox;
|
||||
GdkDevice *device, *keyb, *pointer;
|
||||
GdkWindow *window;
|
||||
gboolean editable;
|
||||
guint32 time;
|
||||
|
||||
@ -674,8 +677,11 @@ gtk_cell_renderer_accel_start_editing (GtkCellRenderer *cell,
|
||||
if (editable == FALSE)
|
||||
return NULL;
|
||||
|
||||
window = gtk_widget_get_window (widget);
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
|
||||
g_return_val_if_fail (window != NULL, NULL);
|
||||
|
||||
if (event)
|
||||
device = gdk_event_get_device (event);
|
||||
else
|
||||
@ -697,16 +703,13 @@ gtk_cell_renderer_accel_start_editing (GtkCellRenderer *cell,
|
||||
|
||||
time = gdk_event_get_time (event);
|
||||
|
||||
priv->grab_invisible = gtk_invisible_new ();
|
||||
gtk_widget_show (priv->grab_invisible);
|
||||
|
||||
if (gdk_device_grab (keyb, gtk_widget_get_window (priv->grab_invisible),
|
||||
if (gdk_device_grab (keyb, window,
|
||||
GDK_OWNERSHIP_WINDOW, FALSE,
|
||||
GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK,
|
||||
NULL, time) != GDK_GRAB_SUCCESS)
|
||||
return NULL;
|
||||
|
||||
if (gdk_device_grab (pointer, gtk_widget_get_window (priv->grab_invisible),
|
||||
if (gdk_device_grab (pointer, window,
|
||||
GDK_OWNERSHIP_WINDOW, FALSE,
|
||||
GDK_BUTTON_PRESS_MASK,
|
||||
NULL, time) != GDK_GRAB_SUCCESS)
|
||||
@ -717,8 +720,9 @@ gtk_cell_renderer_accel_start_editing (GtkCellRenderer *cell,
|
||||
|
||||
priv->grab_keyboard = keyb;
|
||||
priv->grab_pointer = pointer;
|
||||
priv->grab_widget = widget;
|
||||
|
||||
g_signal_connect (G_OBJECT (priv->grab_invisible), "key-press-event",
|
||||
g_signal_connect (G_OBJECT (widget), "key-press-event",
|
||||
G_CALLBACK (grab_key_callback),
|
||||
accel);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user