app: undeprecate gimpdisplayshell-layer-select

This commit is contained in:
Michael Natterer 2018-07-03 15:51:45 +02:00
parent e05c20173a
commit 67062a5867
3 changed files with 24 additions and 20 deletions

View File

@ -60,7 +60,7 @@ static LayerSelect * layer_select_new (GimpDisplayShell *shell,
GimpLayer *layer, GimpLayer *layer,
gint view_size); gint view_size);
static void layer_select_destroy (LayerSelect *layer_select, static void layer_select_destroy (LayerSelect *layer_select,
guint32 time); GdkEvent *event);
static void layer_select_advance (LayerSelect *layer_select, static void layer_select_advance (LayerSelect *layer_select,
gint move); gint move);
static gboolean layer_select_events (GtkWidget *widget, static gboolean layer_select_events (GtkWidget *widget,
@ -72,8 +72,8 @@ static gboolean layer_select_events (GtkWidget *widget,
void void
gimp_display_shell_layer_select_init (GimpDisplayShell *shell, gimp_display_shell_layer_select_init (GimpDisplayShell *shell,
gint move, GdkEvent *event,
guint32 time) gint move)
{ {
LayerSelect *layer_select; LayerSelect *layer_select;
GimpImage *image; GimpImage *image;
@ -81,6 +81,7 @@ gimp_display_shell_layer_select_init (GimpDisplayShell *shell,
GdkGrabStatus status; GdkGrabStatus status;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell)); g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (event != NULL);
image = gimp_display_get_image (shell->display); image = gimp_display_get_image (shell->display);
@ -98,9 +99,16 @@ gimp_display_shell_layer_select_init (GimpDisplayShell *shell,
gtk_widget_show (layer_select->window); gtk_widget_show (layer_select->window);
status = gdk_keyboard_grab (gtk_widget_get_window (layer_select->window), FALSE, time); status = gdk_seat_grab (gdk_event_get_seat (event),
gtk_widget_get_window (layer_select->window),
GDK_SEAT_CAPABILITY_KEYBOARD,
FALSE, NULL, event, NULL, NULL);
if (status != GDK_GRAB_SUCCESS) if (status != GDK_GRAB_SUCCESS)
g_printerr ("gdk_keyboard_grab failed with status %d\n", status); {
g_printerr ("gdk_keyboard_grab failed with status %d\n", status);
layer_select_destroy (layer_select, event);
}
} }
@ -173,10 +181,9 @@ layer_select_new (GimpDisplayShell *shell,
static void static void
layer_select_destroy (LayerSelect *layer_select, layer_select_destroy (LayerSelect *layer_select,
guint32 time) GdkEvent *event)
{ {
gdk_display_keyboard_ungrab (gtk_widget_get_display (layer_select->window), gdk_seat_ungrab (gdk_event_get_seat (event));
time);
gtk_widget_destroy (layer_select->window); gtk_widget_destroy (layer_select->window);
@ -243,15 +250,12 @@ layer_select_events (GtkWidget *widget,
GdkEvent *event, GdkEvent *event,
LayerSelect *layer_select) LayerSelect *layer_select)
{ {
GdkEventKey *kevent; GdkEventKey *kevent;
GdkEventButton *bevent;
switch (event->type) switch (event->type)
{ {
case GDK_BUTTON_PRESS: case GDK_BUTTON_PRESS:
bevent = (GdkEventButton *) event; layer_select_destroy (layer_select, event);
layer_select_destroy (layer_select, bevent->time);
break; break;
case GDK_KEY_PRESS: case GDK_KEY_PRESS:
@ -286,7 +290,7 @@ layer_select_events (GtkWidget *widget,
} }
if (! (kevent->state & GDK_CONTROL_MASK)) if (! (kevent->state & GDK_CONTROL_MASK))
layer_select_destroy (layer_select, kevent->time); layer_select_destroy (layer_select, event);
return TRUE; return TRUE;
break; break;

View File

@ -20,8 +20,8 @@
void gimp_display_shell_layer_select_init (GimpDisplayShell *shell, void gimp_display_shell_layer_select_init (GimpDisplayShell *shell,
gint move, GdkEvent *event,
guint32 time); gint move);
#endif /* __GIMP_DISPLAY_SHELL_LAYER_SELECT_H__ */ #endif /* __GIMP_DISPLAY_SHELL_LAYER_SELECT_H__ */

View File

@ -1703,11 +1703,11 @@ gimp_display_shell_tab_pressed (GimpDisplayShell *shell,
{ {
if (kevent->keyval == GDK_KEY_Tab || if (kevent->keyval == GDK_KEY_Tab ||
kevent->keyval == GDK_KEY_KP_Tab) kevent->keyval == GDK_KEY_KP_Tab)
gimp_display_shell_layer_select_init (shell, gimp_display_shell_layer_select_init (shell, (GdkEvent *) kevent,
1, kevent->time); 1);
else else
gimp_display_shell_layer_select_init (shell, gimp_display_shell_layer_select_init (shell, (GdkEvent *) kevent,
-1, kevent->time); -1);
return TRUE; return TRUE;
} }