[gthumb] removed some deprecated functions
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] removed some deprecated functions
- Date: Thu, 10 Jan 2019 18:17:48 +0000 (UTC)
commit b79bb6ffb5b03191ebcee26bcca2155a91f9f282
Author: Paolo Bacchilega <paobac src gnome org>
Date: Sat Jan 5 11:16:08 2019 +0100
removed some deprecated functions
.../contact_sheet/gth-contact-sheet-theme-dialog.c | 12 +-
extensions/file_manager/actions.c | 8 +-
extensions/file_manager/callbacks.c | 5 +-
extensions/flicker_utils/dlg-export-to-flickr.c | 4 +-
extensions/flicker_utils/flickr-service.c | 8 +-
extensions/image_print/preferences.c | 12 +-
extensions/slideshow/gth-slideshow.c | 20 +-
extensions/webalbums/gth-web-exporter.c | 4 +-
gthumb/gth-browser.c | 82 ++------
gthumb/gth-file-properties.c | 18 +-
gthumb/gth-folder-tree.c | 6 +-
gthumb/gth-grid-view.c | 226 ++++++++++-----------
gthumb/gth-image-dragger.c | 19 +-
gthumb/gth-image-navigator.c | 2 -
gthumb/gth-image-overview.c | 114 +++--------
gthumb/gth-image-selector.c | 23 +--
gthumb/gth-image-viewer.c | 1 -
gthumb/gth-tags-entry.c | 120 ++---------
gthumb/gth-time-selector.c | 138 ++++---------
gthumb/gtk-utils.c | 95 +++++----
gthumb/gtk-utils.h | 9 +-
21 files changed, 318 insertions(+), 608 deletions(-)
---
diff --git a/extensions/contact_sheet/gth-contact-sheet-theme-dialog.c
b/extensions/contact_sheet/gth-contact-sheet-theme-dialog.c
index c9ab23bd..43394df4 100644
--- a/extensions/contact_sheet/gth-contact-sheet-theme-dialog.c
+++ b/extensions/contact_sheet/gth-contact-sheet-theme-dialog.c
@@ -126,17 +126,17 @@ update_theme_from_controls (GthContactSheetThemeDialog *self)
/* header */
- self->priv->theme->header_font_name = g_strdup (gtk_font_button_get_font_name (GTK_FONT_BUTTON
(GET_WIDGET ("header_fontpicker"))));
+ self->priv->theme->header_font_name = g_strdup (gtk_font_chooser_get_font (GTK_FONT_CHOOSER
(GET_WIDGET ("header_fontpicker"))));
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (GET_WIDGET ("header_colorpicker")),
&self->priv->theme->header_color);
/* footer */
- self->priv->theme->footer_font_name = g_strdup (gtk_font_button_get_font_name (GTK_FONT_BUTTON
(GET_WIDGET ("footer_fontpicker"))));
+ self->priv->theme->footer_font_name = g_strdup (gtk_font_chooser_get_font (GTK_FONT_CHOOSER
(GET_WIDGET ("footer_fontpicker"))));
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (GET_WIDGET ("footer_colorpicker")),
&self->priv->theme->footer_color);
/* caption */
- self->priv->theme->caption_font_name = g_strdup (gtk_font_button_get_font_name (GTK_FONT_BUTTON
(GET_WIDGET ("caption_fontpicker"))));
+ self->priv->theme->caption_font_name = g_strdup (gtk_font_chooser_get_font (GTK_FONT_CHOOSER
(GET_WIDGET ("caption_fontpicker"))));
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (GET_WIDGET ("caption_colorpicker")),
&self->priv->theme->caption_color);
}
@@ -376,13 +376,13 @@ update_controls_from_theme (GthContactSheetThemeDialog *self,
gtk_combo_box_set_active (GTK_COMBO_BOX (GET_WIDGET ("frame_style_combobox")), theme->frame_style);
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (GET_WIDGET ("frame_colorpicker")),
&theme->frame_color);
- gtk_font_button_set_font_name (GTK_FONT_BUTTON (GET_WIDGET ("header_fontpicker")),
theme->header_font_name);
+ gtk_font_chooser_set_font (GTK_FONT_CHOOSER (GET_WIDGET ("header_fontpicker")),
theme->header_font_name);
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (GET_WIDGET ("header_colorpicker")),
&theme->header_color);
- gtk_font_button_set_font_name (GTK_FONT_BUTTON (GET_WIDGET ("footer_fontpicker")),
theme->footer_font_name);
+ gtk_font_chooser_set_font (GTK_FONT_CHOOSER (GET_WIDGET ("footer_fontpicker")),
theme->footer_font_name);
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (GET_WIDGET ("footer_colorpicker")),
&theme->footer_color);
- gtk_font_button_set_font_name (GTK_FONT_BUTTON (GET_WIDGET ("caption_fontpicker")),
theme->caption_font_name);
+ gtk_font_chooser_set_font (GTK_FONT_CHOOSER (GET_WIDGET ("caption_fontpicker")),
theme->caption_font_name);
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (GET_WIDGET ("caption_colorpicker")),
&theme->caption_color);
update_preview (self);
diff --git a/extensions/file_manager/actions.c b/extensions/file_manager/actions.c
index 7e86a03e..d3a92406 100644
--- a/extensions/file_manager/actions.c
+++ b/extensions/file_manager/actions.c
@@ -783,10 +783,10 @@ gth_browser_activate_folder_context_open_in_file_manager (GSimpleAction *action,
return;
uri = g_file_get_uri (file_data->file);
- if (! gtk_show_uri (gtk_window_get_screen (GTK_WINDOW (browser)),
- uri,
- gtk_get_current_event_time (),
- &error))
+ if (! gtk_show_uri_on_window (GTK_WINDOW (browser),
+ uri,
+ GDK_CURRENT_TIME,
+ &error))
{
_gtk_error_dialog_from_gerror_run (GTK_WINDOW (browser), _("Could not open the location"),
error);
g_clear_error (&error);
diff --git a/extensions/file_manager/callbacks.c b/extensions/file_manager/callbacks.c
index 88d0c227..d11e181c 100644
--- a/extensions/file_manager/callbacks.c
+++ b/extensions/file_manager/callbacks.c
@@ -188,10 +188,7 @@ gth_file_list_drag_data_received (GtkWidget *file_view,
}
if (action == GDK_ACTION_ASK) {
- GdkDragAction actions =
- _gtk_menu_ask_drag_drop_action (file_view,
- gdk_drag_context_get_actions (context),
- time);
+ GdkDragAction actions = _gtk_menu_ask_drag_drop_action (file_view,
gdk_drag_context_get_actions (context));
gdk_drag_status (context, actions, time);
success = gdk_drag_context_get_selected_action (context) != 0;
}
diff --git a/extensions/flicker_utils/dlg-export-to-flickr.c b/extensions/flicker_utils/dlg-export-to-flickr.c
index 7a4a203f..76ec24c9 100644
--- a/extensions/flicker_utils/dlg-export-to-flickr.c
+++ b/extensions/flicker_utils/dlg-export-to-flickr.c
@@ -103,12 +103,10 @@ completed_messagedialog_response_cb (GtkDialog *dialog,
case _OPEN_IN_BROWSER_RESPONSE:
{
- GdkScreen *screen;
OAuthAccount *account;
char *url = NULL;
GError *error = NULL;
- screen = gtk_widget_get_screen (GTK_WIDGET (dialog));
gtk_widget_destroy (GTK_WIDGET (dialog));
account = web_service_get_current_account (WEB_SERVICE (data->service));
@@ -132,7 +130,7 @@ completed_messagedialog_response_cb (GtkDialog *dialog,
else if (data->photoset->id != NULL)
url = g_strconcat (data->server->url, "/photos/", account->id, "/sets/",
data->photoset->id, NULL);
- if ((url != NULL) && ! gtk_show_uri (screen, url, 0, &error)) {
+ if ((url != NULL) && ! gtk_show_uri_on_window (GTK_WINDOW (data->browser), url,
GDK_CURRENT_TIME, &error)) {
if (data->service != NULL)
gth_task_dialog (GTH_TASK (data->service), TRUE, NULL);
_gtk_error_dialog_from_gerror_run (GTK_WINDOW (data->browser), _("Could not
connect to the server"), error);
diff --git a/extensions/flicker_utils/flickr-service.c b/extensions/flicker_utils/flickr-service.c
index fc6f7261..41954f01 100644
--- a/extensions/flicker_utils/flickr-service.c
+++ b/extensions/flicker_utils/flickr-service.c
@@ -508,13 +508,11 @@ old_authorization_dialog_response_cb (GtkDialog *dialog,
switch (response_id) {
case _RESPONSE_AUTHORIZE:
{
- GdkScreen *screen;
- char *url;
- GError *error = NULL;
+ char *url;
+ GError *error = NULL;
- screen = gtk_widget_get_screen (GTK_WIDGET (dialog));
url = flickr_service_old_auth_get_login_link (self, WEB_AUTHORIZATION_WRITE);
- if (gtk_show_uri (screen, url, 0, &error))
+ if (gtk_show_uri_on_window (GTK_WINDOW (dialog), url, GDK_CURRENT_TIME, &error))
old_authorization_complete (self);
else
gth_task_completed (GTH_TASK (self), error);
diff --git a/extensions/image_print/preferences.c b/extensions/image_print/preferences.c
index 4f1d0d6c..1573389c 100644
--- a/extensions/image_print/preferences.c
+++ b/extensions/image_print/preferences.c
@@ -65,15 +65,15 @@ ip__dlg_preferences_construct_cb (GtkWidget *dialog,
gtk_widget_show (page);
font_name = g_settings_get_string (data->settings, PREF_IMAGE_PRINT_FONT_NAME);
- gtk_font_button_set_font_name (GTK_FONT_BUTTON (GET_WIDGET ("caption_fontbutton")), font_name);
+ gtk_font_chooser_set_font (GTK_FONT_CHOOSER (GET_WIDGET ("caption_fontbutton")), font_name);
g_free (font_name);
font_name = g_settings_get_string (data->settings, PREF_IMAGE_PRINT_HEADER_FONT_NAME);
- gtk_font_button_set_font_name (GTK_FONT_BUTTON (GET_WIDGET ("header_fontbutton")), font_name);
+ gtk_font_chooser_set_font (GTK_FONT_CHOOSER (GET_WIDGET ("header_fontbutton")), font_name);
g_free (font_name);
font_name = g_settings_get_string (data->settings, PREF_IMAGE_PRINT_FOOTER_FONT_NAME);
- gtk_font_button_set_font_name (GTK_FONT_BUTTON (GET_WIDGET ("footer_fontbutton")), font_name);
+ gtk_font_chooser_set_font (GTK_FONT_CHOOSER (GET_WIDGET ("footer_fontbutton")), font_name);
g_free (font_name);
label = gtk_label_new (_("Print"));
@@ -94,7 +94,7 @@ ip__dlg_preferences_apply_cb (GtkWidget *dialog,
data = g_object_get_data (G_OBJECT (dialog), BROWSER_DATA_KEY);
g_return_if_fail (data != NULL);
- g_settings_set_string (data->settings, PREF_IMAGE_PRINT_FONT_NAME, gtk_font_button_get_font_name
(GTK_FONT_BUTTON (GET_WIDGET ("caption_fontbutton"))));
- g_settings_set_string (data->settings, PREF_IMAGE_PRINT_HEADER_FONT_NAME,
gtk_font_button_get_font_name (GTK_FONT_BUTTON (GET_WIDGET ("header_fontbutton"))));
- g_settings_set_string (data->settings, PREF_IMAGE_PRINT_FOOTER_FONT_NAME,
gtk_font_button_get_font_name (GTK_FONT_BUTTON (GET_WIDGET ("footer_fontbutton"))));
+ g_settings_set_string (data->settings, PREF_IMAGE_PRINT_FONT_NAME, gtk_font_chooser_get_font
(GTK_FONT_CHOOSER (GET_WIDGET ("caption_fontbutton"))));
+ g_settings_set_string (data->settings, PREF_IMAGE_PRINT_HEADER_FONT_NAME, gtk_font_chooser_get_font
(GTK_FONT_CHOOSER (GET_WIDGET ("header_fontbutton"))));
+ g_settings_set_string (data->settings, PREF_IMAGE_PRINT_FOOTER_FONT_NAME, gtk_font_chooser_get_font
(GTK_FONT_CHOOSER (GET_WIDGET ("footer_fontbutton"))));
}
diff --git a/extensions/slideshow/gth-slideshow.c b/extensions/slideshow/gth-slideshow.c
index dd15ba4d..769d3f1d 100644
--- a/extensions/slideshow/gth-slideshow.c
+++ b/extensions/slideshow/gth-slideshow.c
@@ -195,7 +195,6 @@ _gth_slideshow_load_current_image (GthSlideshow *self)
GthFileData *prev_file;
int screen_width;
int screen_height;
- GdkScreen *screen;
if (self->priv->next_event != 0) {
g_source_remove (self->priv->next_event);
@@ -220,14 +219,7 @@ _gth_slideshow_load_current_image (GthSlideshow *self)
else
prev_file = NULL;
- screen_width = -1;
- screen_height = -1;
- screen = gtk_widget_get_screen (GTK_WIDGET (self));
- if (screen != NULL) {
- screen_width = gdk_screen_get_width (screen);
- screen_height = gdk_screen_get_height (screen);
- }
-
+ _gtk_widget_get_screen_size (GTK_WIDGET (self), &screen_width, &screen_height);
gth_image_preloader_load (self->priv->preloader,
requested_file,
MAX (screen_width, screen_height),
@@ -717,19 +709,19 @@ default_projector_pause_painter (GthImageViewer *image_viewer,
gpointer user_data)
{
GthSlideshow *self = user_data;
- GdkScreen *screen;
+ int screen_width;
+ int screen_height;
double dest_x;
double dest_y;
if (! self->priv->paused || ! self->priv->paint_paused || (self->priv->pause_pixbuf == NULL))
return;
- screen = gtk_widget_get_screen (GTK_WIDGET (image_viewer));
- if (screen == NULL)
+ if (! _gtk_widget_get_screen_size (GTK_WIDGET (image_viewer), &screen_width, &screen_height))
return;
- dest_x = (gdk_screen_get_width (screen) - gdk_pixbuf_get_width (self->priv->pause_pixbuf)) / 2.0;
- dest_y = (gdk_screen_get_height (screen) - gdk_pixbuf_get_height (self->priv->pause_pixbuf)) / 2.0;
+ dest_x = (screen_width - gdk_pixbuf_get_width (self->priv->pause_pixbuf)) / 2.0;
+ dest_y = (screen_height - gdk_pixbuf_get_height (self->priv->pause_pixbuf)) / 2.0;
gdk_cairo_set_source_pixbuf (cr, self->priv->pause_pixbuf, dest_x, dest_y);
cairo_rectangle (cr, dest_x, dest_y, gdk_pixbuf_get_width (self->priv->pause_pixbuf),
gdk_pixbuf_get_height (self->priv->pause_pixbuf));
cairo_fill (cr);
diff --git a/extensions/webalbums/gth-web-exporter.c b/extensions/webalbums/gth-web-exporter.c
index c477cebf..969c17f7 100644
--- a/extensions/webalbums/gth-web-exporter.c
+++ b/extensions/webalbums/gth-web-exporter.c
@@ -1779,9 +1779,7 @@ success_dialog_response_cb (GtkDialog *dialog,
gpointer user_data)
{
GthWebExporter *self = user_data;
- GdkScreen *screen;
- screen = gtk_widget_get_screen (GTK_WIDGET (dialog));
gtk_widget_destroy (GTK_WIDGET (dialog));
switch (response_id) {
@@ -1800,7 +1798,7 @@ success_dialog_response_cb (GtkDialog *dialog,
break;
url = g_file_get_uri (file);
- if ((url != NULL) && ! gtk_show_uri (screen, url, 0, &error)) {
+ if ((url != NULL) && ! gtk_show_uri_on_window (GTK_WINDOW (self->priv->browser), url,
GDK_CURRENT_TIME, &error)) {
gth_task_dialog (GTH_TASK (self), TRUE, NULL);
_gtk_error_dialog_from_gerror_run (GTK_WINDOW (self->priv->browser), _("Could
not show the destination"), error);
g_clear_error (&error);
diff --git a/gthumb/gth-browser.c b/gthumb/gth-browser.c
index 7df65018..5b4e62fd 100644
--- a/gthumb/gth-browser.c
+++ b/gthumb/gth-browser.c
@@ -2483,7 +2483,7 @@ _gth_browser_real_set_current_page (GthWindow *window,
GtkWidget *file_properties_parent;
file_properties_parent = _gth_browser_get_browser_file_properties_container (browser);
- gtk_widget_reparent (browser->priv->file_properties, file_properties_parent);
+ _gtk_widget_reparent (browser->priv->file_properties, file_properties_parent);
/* restore the child properties that gtk_widget_reparent doesn't preserve. */
gtk_container_child_set (GTK_CONTAINER (file_properties_parent),
browser->priv->file_properties,
@@ -2492,7 +2492,7 @@ _gth_browser_real_set_current_page (GthWindow *window,
NULL);
}
else
- gtk_widget_reparent (browser->priv->file_properties, browser->priv->viewer_sidebar_container);
+ _gtk_widget_reparent (browser->priv->file_properties,
browser->priv->viewer_sidebar_container);
/* update the sidebar state depending on the current visible page */
@@ -2838,10 +2838,7 @@ folder_tree_drag_data_received (GtkWidget *tree_view,
}
if (success && (suggested_action == GDK_ACTION_ASK)) {
- GdkDragAction action =
- _gtk_menu_ask_drag_drop_action (tree_view,
- gdk_drag_context_get_actions (context),
- time);
+ GdkDragAction action = _gtk_menu_ask_drag_drop_action (tree_view,
gdk_drag_context_get_actions (context));
gdk_drag_status (context, action, time);
success = gdk_drag_context_get_selected_action (context) != 0;
}
@@ -2960,13 +2957,7 @@ folder_tree_folder_popup_cb (GthFolderTree *folder_tree,
file_source = NULL;
gth_hook_invoke ("gth-browser-folder-tree-popup-before", browser, file_source, file_data);
- gtk_menu_popup (GTK_MENU (browser->priv->folder_popup),
- NULL,
- NULL,
- NULL,
- NULL,
- 3,
- (guint32) time);
+ gtk_menu_popup_at_pointer (GTK_MENU (browser->priv->folder_popup), NULL);
if (file_data != NULL) {
GtkTreePath *path;
@@ -3634,26 +3625,8 @@ static void
gth_file_list_popup_menu (GthBrowser *browser,
GdkEventButton *event)
{
- int button, event_time;
-
gth_hook_invoke ("gth-browser-file-list-popup-before", browser);
-
- if (event != NULL) {
- button = event->button;
- event_time = event->time;
- }
- else {
- button = 0;
- event_time = gtk_get_current_event_time ();
- }
-
- gtk_menu_popup (GTK_MENU (browser->priv->file_list_popup),
- NULL,
- NULL,
- NULL,
- NULL,
- button,
- event_time);
+ gtk_menu_popup_at_pointer (GTK_MENU (browser->priv->file_list_popup), (GdkEvent *) event);
}
@@ -3941,7 +3914,7 @@ pref_browser_properties_on_the_right_changed (GSettings *settings,
return;
gtk_widget_unrealize (browser->priv->file_properties);
- gtk_widget_reparent (browser->priv->file_properties, new_parent);
+ _gtk_widget_reparent (browser->priv->file_properties, new_parent);
/* restore the child properties that gtk_widget_reparent doesn't preserve. */
gtk_container_child_set (GTK_CONTAINER (new_parent),
browser->priv->file_properties,
@@ -4366,18 +4339,17 @@ gth_browser_init (GthBrowser *browser)
window_height = g_settings_get_int (browser->priv->browser_settings, PREF_BROWSER_WINDOW_HEIGHT);
if ((window_width == 0) || (window_height == 0)) {
- GdkScreen *screen;
- int max_width;
- int max_height;
- int sidebar_width;
- int thumb_size;
- int thumb_spacing;
- int default_columns_of_thumbnails;
- int n_cols;
-
- screen = gtk_widget_get_screen (GTK_WIDGET (browser));
- max_width = gdk_screen_get_width (screen) * 5 / 6;
- max_height = gdk_screen_get_height (screen) * 3 / 4;
+ int max_width;
+ int max_height;
+ int sidebar_width;
+ int thumb_size;
+ int thumb_spacing;
+ int default_columns_of_thumbnails;
+ int n_cols;
+
+ _gtk_widget_get_screen_size (GTK_WIDGET (browser), &max_width, &max_height);
+ max_width = max_width * 5 / 6;
+ max_height = max_height * 3 / 4;
sidebar_width = g_settings_get_int (browser->priv->browser_settings,
PREF_BROWSER_BROWSER_SIDEBAR_WIDTH) + 10;
thumb_size = g_settings_get_int (browser->priv->browser_settings,
PREF_BROWSER_THUMBNAIL_SIZE);
@@ -6917,26 +6889,8 @@ void
gth_browser_file_menu_popup (GthBrowser *browser,
GdkEventButton *event)
{
- int button;
- int event_time;
-
- if (event != NULL) {
- button = event->button;
- event_time = event->time;
- }
- else {
- button = 0;
- event_time = gtk_get_current_event_time ();
- }
-
gth_hook_invoke ("gth-browser-file-popup-before", browser);
- gtk_menu_popup (GTK_MENU (browser->priv->file_popup),
- NULL,
- NULL,
- NULL,
- NULL,
- button,
- event_time);
+ gtk_menu_popup_at_pointer (GTK_MENU (browser->priv->file_popup), (GdkEvent *) event);
}
diff --git a/gthumb/gth-file-properties.c b/gthumb/gth-file-properties.c
index 627f9223..956e8eaf 100644
--- a/gthumb/gth-file-properties.c
+++ b/gthumb/gth-file-properties.c
@@ -384,13 +384,7 @@ tree_view_button_press_event_cb (GtkWidget *widget,
return FALSE;
gtk_tree_selection_select_path (GTK_TREE_SELECTION (gtk_tree_view_get_selection
(GTK_TREE_VIEW (self->priv->tree_view))), path);
- gtk_menu_popup (GTK_MENU (self->priv->popup_menu),
- NULL,
- NULL,
- NULL,
- NULL,
- event->button,
- event->time);
+ gtk_menu_popup_at_pointer (GTK_MENU (self->priv->popup_menu), (GdkEvent *) event);
gtk_tree_path_free (path);
@@ -406,15 +400,7 @@ tree_view_popup_menu_cb (GtkWidget *widget,
gpointer user_data)
{
GthFileProperties *self = user_data;
-
- gtk_menu_popup (GTK_MENU (self->priv->popup_menu),
- NULL,
- NULL,
- NULL,
- NULL,
- 0,
- gtk_get_current_event_time ());
-
+ gtk_menu_popup_at_pointer (GTK_MENU (self->priv->popup_menu), NULL);
return TRUE;
}
diff --git a/gthumb/gth-folder-tree.c b/gthumb/gth-folder-tree.c
index 73c15376..60a52e66 100644
--- a/gthumb/gth-folder-tree.c
+++ b/gthumb/gth-folder-tree.c
@@ -1421,9 +1421,9 @@ emit_fake_motion_notify_event (GthFolderTree *folder_tree)
if (! gtk_widget_get_realized (widget))
return;
- device = gdk_device_manager_get_client_pointer (
- gdk_display_get_device_manager (
- gtk_widget_get_display (GTK_WIDGET (folder_tree))));
+ device = _gtk_widget_get_client_pointer (widget);
+ if (device == NULL)
+ return;
window = gdk_window_get_device_position (gtk_widget_get_window (widget),
device,
&x,
diff --git a/gthumb/gth-grid-view.c b/gthumb/gth-grid-view.c
index 106fcedc..78165dba 100644
--- a/gthumb/gth-grid-view.c
+++ b/gthumb/gth-grid-view.c
@@ -1284,7 +1284,6 @@ _gth_grid_view_item_draw_thumbnail (GthGridViewItem *item,
cairo_surface_t *image;
GtkStyleContext *style_context;
cairo_rectangle_int_t frame_rect;
- gboolean gtk320 = ((gtk_major_version >= 3) && (gtk_minor_version >= 20));
image = item->thumbnail;
if (image == NULL)
@@ -1295,47 +1294,46 @@ _gth_grid_view_item_draw_thumbnail (GthGridViewItem *item,
cairo_save (cr);
style_context = gtk_widget_get_style_context (widget);
gtk_style_context_save (style_context);
- if (gtk320) {
- gtk_style_context_set_state (style_context, item_state);
- }
- else {
- gtk_style_context_remove_class (style_context, GTK_STYLE_CLASS_VIEW);
- gtk_style_context_add_class (style_context, GTK_STYLE_CLASS_CELL);
- }
+
+#if GTK_CHECK_VERSION(3, 20, 0)
+ gtk_style_context_set_state (style_context, item_state);
+#else
+ gtk_style_context_remove_class (style_context, GTK_STYLE_CLASS_VIEW);
+ gtk_style_context_add_class (style_context, GTK_STYLE_CLASS_CELL);
+#endif
frame_rect = item->pixbuf_area;
if ((item->style == ITEM_STYLE_ICON)
|| ! (item->is_image || (item_state & GTK_STATE_FLAG_SELECTED) || (item_state ==
GTK_STATE_FLAG_NORMAL)))
{
- GdkRGBA background_color;
-
/* use a gray rounded box for icons or when the original size
* is smaller than the thumbnail size... */
- if (gtk320) {
- gtk_style_context_save (style_context);
- gtk_style_context_add_class (style_context, "icon");
- gtk_render_background (style_context,
- cr,
- item->thumbnail_area.x,
- item->thumbnail_area.y,
- item->thumbnail_area.width,
- item->thumbnail_area.height);
- gtk_style_context_restore (style_context);
- }
- else {
- gtk_style_context_get_background_color (style_context, item_state, &background_color);
- gdk_cairo_set_source_rgba (cr, &background_color);
+#if GTK_CHECK_VERSION(3, 20, 0)
+ gtk_style_context_save (style_context);
+ gtk_style_context_add_class (style_context, "icon");
+ gtk_render_background (style_context,
+ cr,
+ item->thumbnail_area.x,
+ item->thumbnail_area.y,
+ item->thumbnail_area.width,
+ item->thumbnail_area.height);
+ gtk_style_context_restore (style_context);
+#else
+ GdkRGBA background_color;
- _cairo_draw_rounded_box (cr,
- item->thumbnail_area.x,
- item->thumbnail_area.y,
- item->thumbnail_area.width,
- item->thumbnail_area.height,
- 4);
- cairo_fill (cr);
- }
+ gtk_style_context_get_background_color (style_context, item_state, &background_color);
+ gdk_cairo_set_source_rgba (cr, &background_color);
+
+ _cairo_draw_rounded_box (cr,
+ item->thumbnail_area.x,
+ item->thumbnail_area.y,
+ item->thumbnail_area.width,
+ item->thumbnail_area.height,
+ 4);
+ cairo_fill (cr);
+#endif
}
if (item->style == ITEM_STYLE_IMAGE) {
@@ -1456,32 +1454,31 @@ _gth_grid_view_item_draw_thumbnail (GthGridViewItem *item,
}
if ((item_state & GTK_STATE_FLAG_SELECTED) || (item_state & GTK_STATE_FLAG_FOCUSED)) {
- if (gtk320) {
- gtk_style_context_save (style_context);
- gtk_style_context_add_class (style_context, "icon-effect");
- gtk_render_background (style_context,
- cr,
- frame_rect.x,
- frame_rect.y,
- frame_rect.width,
- frame_rect.height);
- gtk_style_context_restore (style_context);
- }
- else {
- GdkRGBA color;
- gtk_style_context_get_background_color (style_context, item_state, &color);
- cairo_set_source_rgba (cr, color.red, color.green, color.blue, 0.5);
- cairo_rectangle (cr,
- frame_rect.x,
- frame_rect.y,
- frame_rect.width,
- frame_rect.height);
- cairo_fill_preserve (cr);
+#if GTK_CHECK_VERSION(3, 20, 0)
+ gtk_style_context_save (style_context);
+ gtk_style_context_add_class (style_context, "icon-effect");
+ gtk_render_background (style_context,
+ cr,
+ frame_rect.x,
+ frame_rect.y,
+ frame_rect.width,
+ frame_rect.height);
+ gtk_style_context_restore (style_context);
+#else
+ GdkRGBA color;
+ gtk_style_context_get_background_color (style_context, item_state, &color);
+ cairo_set_source_rgba (cr, color.red, color.green, color.blue, 0.5);
+ cairo_rectangle (cr,
+ frame_rect.x,
+ frame_rect.y,
+ frame_rect.width,
+ frame_rect.height);
+ cairo_fill_preserve (cr);
- cairo_set_line_width (cr, 2);
- cairo_set_source_rgb (cr, color.red, color.green, color.blue);
- cairo_stroke (cr);
- }
+ cairo_set_line_width (cr, 2);
+ cairo_set_source_rgb (cr, color.red, color.green, color.blue);
+ cairo_stroke (cr);
+#endif
}
gtk_style_context_restore (style_context);
@@ -1593,77 +1590,76 @@ _gth_grid_view_draw_item (GthGridView *self,
item_state ^= GTK_STATE_FLAG_ACTIVE;
if (item_state ^ GTK_STATE_FLAG_NORMAL) {
- gboolean gtk320 = ((gtk_major_version >= 3) && (gtk_minor_version >= 20));
GtkStyleContext *style_context;
- GdkRGBA color;
cairo_save (cr);
style_context = gtk_widget_get_style_context (GTK_WIDGET (self));
gtk_style_context_save (style_context);
- if (gtk320) {
- gtk_style_context_set_state (style_context, item_state);
+#if GTK_CHECK_VERSION(3, 20, 0)
+ gtk_style_context_set_state (style_context, item_state);
- if (item->style != ITEM_STYLE_ICON) {
- cairo_region_t *area;
- cairo_rectangle_int_t extents;
+ if (item->style != ITEM_STYLE_ICON) {
+ cairo_region_t *area;
+ cairo_rectangle_int_t extents;
- area = cairo_region_create_rectangle (&item->thumbnail_area);
- cairo_region_union_rectangle (area, &item->caption_area);
- cairo_region_get_extents (area, &extents);
+ area = cairo_region_create_rectangle (&item->thumbnail_area);
+ cairo_region_union_rectangle (area, &item->caption_area);
+ cairo_region_get_extents (area, &extents);
- gtk_render_background (style_context,
- cr,
- extents.x - self->priv->cell_padding,
- extents.y - self->priv->cell_padding,
- extents.width + (self->priv->cell_padding * 2),
- extents.height + (self->priv->cell_padding * 2));
+ gtk_render_background (style_context,
+ cr,
+ extents.x - self->priv->cell_padding,
+ extents.y - self->priv->cell_padding,
+ extents.width + (self->priv->cell_padding * 2),
+ extents.height + (self->priv->cell_padding * 2));
- cairo_region_destroy (area);
- }
- else
- gtk_render_background (style_context,
- cr,
- item->area.x,
- item->area.y,
- item->area.width,
- item->area.height);
+ cairo_region_destroy (area);
}
- else {
- gtk_style_context_remove_class (style_context, GTK_STYLE_CLASS_VIEW);
- gtk_style_context_add_class (style_context, GTK_STYLE_CLASS_CELL);
- gtk_style_context_set_state (style_context, item_state);
- gtk_style_context_get_background_color (style_context, item_state, &color);
- _gdk_rgba_lighter (&color, &color);
- cairo_set_source_rgba (cr, color.red, color.green, color.blue, color.alpha);
-
- if (item->style != ITEM_STYLE_ICON) {
- cairo_region_t *area;
- cairo_rectangle_int_t extents;
-
- area = cairo_region_create_rectangle (&item->thumbnail_area);
- cairo_region_union_rectangle (area, &item->caption_area);
- cairo_region_get_extents (area, &extents);
-
- _cairo_draw_rounded_box (cr,
- extents.x - self->priv->cell_padding,
- extents.y - self->priv->cell_padding,
- extents.width + (self->priv->cell_padding * 2),
- extents.height + (self->priv->cell_padding * 2),
- 4);
-
- cairo_region_destroy (area);
- }
- else
- _cairo_draw_rounded_box (cr,
- item->area.x,
- item->area.y,
- item->area.width,
- item->area.height,
- 4);
+ else
+ gtk_render_background (style_context,
+ cr,
+ item->area.x,
+ item->area.y,
+ item->area.width,
+ item->area.height);
+#else
+ GdkRGBA color;
- cairo_fill (cr);
+ gtk_style_context_remove_class (style_context, GTK_STYLE_CLASS_VIEW);
+ gtk_style_context_add_class (style_context, GTK_STYLE_CLASS_CELL);
+ gtk_style_context_set_state (style_context, item_state);
+ gtk_style_context_get_background_color (style_context, item_state, &color);
+ _gdk_rgba_lighter (&color, &color);
+ cairo_set_source_rgba (cr, color.red, color.green, color.blue, color.alpha);
+
+ if (item->style != ITEM_STYLE_ICON) {
+ cairo_region_t *area;
+ cairo_rectangle_int_t extents;
+
+ area = cairo_region_create_rectangle (&item->thumbnail_area);
+ cairo_region_union_rectangle (area, &item->caption_area);
+ cairo_region_get_extents (area, &extents);
+
+ _cairo_draw_rounded_box (cr,
+ extents.x - self->priv->cell_padding,
+ extents.y - self->priv->cell_padding,
+ extents.width + (self->priv->cell_padding * 2),
+ extents.height + (self->priv->cell_padding * 2),
+ 4);
+
+ cairo_region_destroy (area);
}
+ else
+ _cairo_draw_rounded_box (cr,
+ item->area.x,
+ item->area.y,
+ item->area.width,
+ item->area.height,
+ 4);
+
+ cairo_fill (cr);
+#endif
gtk_style_context_restore (style_context);
cairo_restore (cr);
diff --git a/gthumb/gth-image-dragger.c b/gthumb/gth-image-dragger.c
index 2adf047b..27aafb56 100644
--- a/gthumb/gth-image-dragger.c
+++ b/gthumb/gth-image-dragger.c
@@ -319,15 +319,14 @@ gth_image_dragger_button_press (GthImageViewerTool *self,
GdkGrabStatus retval;
cursor = gdk_cursor_new_from_name (gtk_widget_get_display (widget), "grabbing");
- retval = gdk_device_grab (event->device,
- gtk_widget_get_window (widget),
- GDK_OWNERSHIP_WINDOW,
- FALSE,
- (GDK_POINTER_MOTION_MASK
- | GDK_POINTER_MOTION_HINT_MASK
- | GDK_BUTTON_RELEASE_MASK),
- cursor,
- event->time);
+ retval = gdk_seat_grab (gdk_device_get_seat (gdk_event_get_device ((GdkEvent *) event)),
+ gtk_widget_get_window (widget),
+ GDK_SEAT_CAPABILITY_ALL_POINTING,
+ TRUE,
+ cursor,
+ (GdkEvent *) event,
+ NULL,
+ NULL);
if (cursor != NULL)
g_object_unref (cursor);
@@ -359,7 +358,7 @@ gth_image_dragger_button_release (GthImageViewerTool *self,
viewer = dragger->priv->viewer;
if (viewer->dragging)
- gdk_device_ungrab (event->device, event->time);
+ gdk_seat_ungrab (gdk_device_get_seat (event->device));
return TRUE;
}
diff --git a/gthumb/gth-image-navigator.c b/gthumb/gth-image-navigator.c
index eeafcb37..895d61a6 100644
--- a/gthumb/gth-image-navigator.c
+++ b/gthumb/gth-image-navigator.c
@@ -479,8 +479,6 @@ navigator_event_area_button_press_event_cb (GtkWidget *widget,
nav_popup->y_root = event->y_root;
nav_popup->window_moved = FALSE;
- gtk_window_set_wmclass (GTK_WINDOW (nav_popup->popup_win), "", "gthumb_navigator");
-
out_frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (out_frame), GTK_SHADOW_OUT);
gtk_container_add (GTK_CONTAINER (nav_popup->popup_win), out_frame);
diff --git a/gthumb/gth-image-overview.c b/gthumb/gth-image-overview.c
index 36f39bc5..11f86748 100644
--- a/gthumb/gth-image-overview.c
+++ b/gthumb/gth-image-overview.c
@@ -62,8 +62,7 @@ struct _GthImageOverviewPrivate {
gulong hadj_changed_id;
gboolean scrolling_active;
gboolean update_preview;
- GdkDevice *grab_pointer;
- GdkDevice *grab_keyboard;
+ GdkDevice *grab_device;
GthTask *scale_task;
};
@@ -519,8 +518,7 @@ gth_image_overview_realize (GtkWidget *widget)
static void
-_gth_image_overview_ungrab_devices (GthImageOverview *self,
- guint32 time);
+_gth_image_overview_ungrab_devices (GthImageOverview *self);
static void
@@ -529,7 +527,7 @@ gth_image_overview_unmap (GtkWidget *widget)
GthImageOverview *self;
self = GTH_IMAGE_OVERVIEW (widget);
- _gth_image_overview_ungrab_devices (self, GDK_CURRENT_TIME);
+ _gth_image_overview_ungrab_devices (self);
GTK_WIDGET_CLASS (gth_image_overview_parent_class)->unmap (widget);
}
@@ -801,7 +799,7 @@ _gth_image_overview_grab_broken_event (GtkWidget *widget,
GthImageOverview *self = user_data;
if (event->grab_window == NULL)
- _gth_image_overview_ungrab_devices (self, GDK_CURRENT_TIME);
+ _gth_image_overview_ungrab_devices (self);
return TRUE;
}
@@ -827,8 +825,7 @@ gth_image_overview_init (GthImageOverview *self)
self->priv->hadj_changed_id = 0;
self->priv->scrolling_active = FALSE;
self->priv->update_preview = TRUE;
- self->priv->grab_pointer = NULL;
- self->priv->grab_keyboard = NULL;
+ self->priv->grab_device = NULL;
self->priv->scale_task = NULL;
gtk_widget_set_has_window (GTK_WIDGET (self), TRUE);
@@ -885,61 +882,14 @@ gth_image_overview_get_visible_area (GthImageOverview *self,
}
-static gboolean
-_gth_image_overview_grab_devices (GthImageOverview *self,
- GdkDevice *keyboard,
- GdkDevice *pointer,
- GdkCursor *cursor,
- guint32 time)
-{
- if (keyboard != NULL) {
- if (gdk_device_grab (keyboard,
- gtk_widget_get_window (GTK_WIDGET (self)),
- GDK_OWNERSHIP_WINDOW,
- FALSE,
- (GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK),
- NULL,
- time) != GDK_GRAB_SUCCESS)
- {
- return FALSE;
- }
- }
-
- if (pointer != NULL) {
- if (gdk_device_grab (pointer,
- gtk_widget_get_window (GTK_WIDGET (self)),
- GDK_OWNERSHIP_WINDOW,
- FALSE,
- (GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
GDK_POINTER_MOTION_MASK | GDK_SCROLL_MASK),
- cursor,
- time) != GDK_GRAB_SUCCESS)
- {
- if (keyboard != NULL)
- gdk_device_ungrab (keyboard, time);
-
- return FALSE;
- }
- }
-
- return TRUE;
-}
-
-
static void
-_gth_image_overview_ungrab_devices (GthImageOverview *self,
- guint32 time)
+_gth_image_overview_ungrab_devices (GthImageOverview *self)
{
- if (self->priv->grab_pointer != NULL) {
- gdk_device_ungrab (self->priv->grab_pointer, time);
- gtk_device_grab_remove (GTK_WIDGET (self), self->priv->grab_pointer);
- self->priv->grab_pointer = NULL;
- }
- if (self->priv->grab_keyboard != NULL) {
- gdk_device_ungrab (self->priv->grab_keyboard, time);
- self->priv->grab_keyboard = NULL;
+ if (self->priv->grab_device != NULL) {
+ gdk_seat_ungrab (gdk_device_get_seat (self->priv->grab_device));
+ gtk_device_grab_remove (GTK_WIDGET (self), self->priv->grab_device);
+ self->priv->grab_device = NULL;
}
-
- self->priv->scrolling_active = FALSE;
}
@@ -954,43 +904,29 @@ gth_image_overview_activate_scrolling (GthImageOverview *self,
return;
if (active && ! self->priv->scrolling_active) {
- GdkDevice *device;
- GdkDevice *pointer;
- GdkDevice *keyboard;
- GdkCursor *cursor;
-
- if ((self->priv->grab_pointer != NULL) || (self->priv->grab_keyboard != NULL))
- return;
+ GdkCursor *cursor;
+ GdkGrabStatus grab_status;
- /* capture mouse events */
-
- device = gdk_event_get_device ((GdkEvent *) event);
- if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD) {
- keyboard = device;
- pointer = gdk_device_get_associated_device (device);
- }
- else {
- pointer = device;
- keyboard = gdk_device_get_associated_device (device);
- }
+ /* capture mouse and keyboard events */
+ self->priv->grab_device = gdk_event_get_device ((GdkEvent *) event);
cursor = _gdk_cursor_new_for_widget (GTK_WIDGET (self->priv->viewer), GDK_FLEUR);
- if (_gth_image_overview_grab_devices (self,
- keyboard,
- pointer,
- cursor,
- event->time))
- {
- self->priv->grab_pointer = pointer;
- self->priv->grab_keyboard = keyboard;
- gtk_device_grab_add (GTK_WIDGET (self), self->priv->grab_pointer, TRUE);
- }
+ grab_status = gdk_seat_grab (gdk_device_get_seat (self->priv->grab_device),
+ gtk_widget_get_window (GTK_WIDGET (self)),
+ GDK_SEAT_CAPABILITY_KEYBOARD | GDK_SEAT_CAPABILITY_ALL_POINTING,
+ TRUE,
+ cursor,
+ (GdkEvent *) event,
+ NULL,
+ NULL);
+ if (grab_status == GDK_GRAB_SUCCESS)
+ gtk_device_grab_add (GTK_WIDGET (self), self->priv->grab_device, TRUE);
g_object_unref (cursor);
}
else if (! active && self->priv->scrolling_active)
- _gth_image_overview_ungrab_devices (self, event->time);
+ _gth_image_overview_ungrab_devices (self);
self->priv->scrolling_active = active;
}
diff --git a/gthumb/gth-image-selector.c b/gthumb/gth-image-selector.c
index f1ea0a5d..271f286c 100644
--- a/gthumb/gth-image-selector.c
+++ b/gthumb/gth-image-selector.c
@@ -1480,18 +1480,17 @@ gth_image_selector_motion_notify (GthImageViewerTool *base,
|| (abs (self->priv->viewer->drag_y - self->priv->viewer->drag_y_prev) > DRAG_THRESHOLD))
&& (self->priv->current_area != NULL))
{
- GdkGrabStatus retval;
-
- retval = gdk_device_grab (event->device,
- gtk_widget_get_window (widget),
- GDK_OWNERSHIP_WINDOW,
- FALSE,
- (GDK_POINTER_MOTION_MASK
- | GDK_POINTER_MOTION_HINT_MASK
- | GDK_BUTTON_RELEASE_MASK),
- self->priv->current_area->cursor,
- event->time);
- if (retval == GDK_GRAB_SUCCESS)
+ GdkGrabStatus status;
+
+ status = gdk_seat_grab (gdk_device_get_seat (gdk_event_get_device ((GdkEvent *) event)),
+ gtk_widget_get_window (widget),
+ GDK_SEAT_CAPABILITY_ALL_POINTING,
+ TRUE,
+ self->priv->current_area->cursor,
+ (GdkEvent *) event,
+ NULL,
+ NULL);
+ if (status == GDK_GRAB_SUCCESS)
self->priv->viewer->dragging = TRUE;
return FALSE;
diff --git a/gthumb/gth-image-viewer.c b/gthumb/gth-image-viewer.c
index 5391028a..1f4b6f1d 100644
--- a/gthumb/gth-image-viewer.c
+++ b/gthumb/gth-image-viewer.c
@@ -1512,7 +1512,6 @@ static void
gth_image_viewer_init (GthImageViewer *self)
{
gtk_widget_set_can_focus (GTK_WIDGET (self), TRUE);
- gtk_widget_set_double_buffered (GTK_WIDGET (self), TRUE);
gtk_widget_set_has_window (GTK_WIDGET (self), TRUE);
/* Initialize data. */
diff --git a/gthumb/gth-tags-entry.c b/gthumb/gth-tags-entry.c
index 3aba7342..0dd459bb 100644
--- a/gthumb/gth-tags-entry.c
+++ b/gthumb/gth-tags-entry.c
@@ -84,8 +84,7 @@ typedef struct {
typedef struct {
GtkWidget *window;
GtkWidget *container;
- GdkDevice *grab_pointer;
- GdkDevice *grab_keyboard;
+ GdkDevice *grab_device;
} PopupWindow;
@@ -852,16 +851,8 @@ expanded_list_button_press_event_cb (GtkStatusIcon *status_icon,
{
GthTagsEntry *self = user_data;
- if (event->button == 3) {
- gtk_menu_popup (GTK_MENU (self->priv->expanded_list.popup_menu),
- NULL,
- NULL,
- NULL,
- NULL,
- event->button,
- event->time);
- return FALSE;
- }
+ if (event->button == 3)
+ gtk_menu_popup_at_pointer (GTK_MENU (self->priv->expanded_list.popup_menu), (GdkEvent *)
event);
return FALSE;
}
@@ -874,15 +865,9 @@ static void
_gth_tags_entry_ungrab_devices (GthTagsEntry *self,
guint32 time)
{
- if (self->priv->popup.grab_pointer != NULL) {
- gdk_device_ungrab (self->priv->popup.grab_pointer, time);
- gtk_device_grab_remove (self->priv->popup.window, self->priv->popup.grab_pointer);
- self->priv->popup.grab_pointer = NULL;
- }
-
- if (self->priv->popup.grab_keyboard != NULL) {
- gdk_device_ungrab (self->priv->popup.grab_keyboard, time);
- self->priv->popup.grab_keyboard = NULL;
+ if (self->priv->popup.grab_device != NULL) {
+ gtk_device_grab_remove (self->priv->popup.window, self->priv->popup.grab_device);
+ self->priv->popup.grab_device = NULL;
}
}
@@ -960,46 +945,6 @@ popup_window_key_press_event_cb (GtkWidget *widget,
}
-static gboolean
-_gth_tags_entry_grab_devices (GdkWindow *window,
- GdkDevice *keyboard,
- GdkDevice *pointer,
- GdkCursor *cursor,
- guint32 time)
-{
- if (keyboard != NULL) {
- if (gdk_device_grab (keyboard,
- window,
- GDK_OWNERSHIP_APPLICATION,
- TRUE,
- (GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK),
- NULL,
- time) != GDK_GRAB_SUCCESS)
- {
- return FALSE;
- }
- }
-
- if (pointer != NULL) {
- if (gdk_device_grab (pointer,
- window,
- GDK_OWNERSHIP_APPLICATION,
- TRUE,
- GDK_ALL_EVENTS_MASK,
- cursor,
- time) != GDK_GRAB_SUCCESS)
- {
- if (keyboard != NULL)
- gdk_device_ungrab (keyboard, time);
-
- return FALSE;
- }
- }
-
- return TRUE;
-}
-
-
static void
popup_window_show (GthTagsEntry *self)
{
@@ -1009,9 +954,7 @@ popup_window_show (GthTagsEntry *self)
GtkAllocation allocation;
int selector_height;
GdkRectangle monitor;
- GdkDevice *device;
- GdkDevice *pointer;
- GdkDevice *keyboard;
+ GdkGrabStatus grab_status;
gdk_window_get_position (gtk_widget_get_window (GTK_WIDGET (self)), &x, &y);
gtk_widget_get_allocation (self->priv->entry, &allocation);
@@ -1037,40 +980,18 @@ popup_window_show (GthTagsEntry *self)
gtk_window_move (GTK_WINDOW (self->priv->popup.window), x, y);
gtk_widget_show (self->priv->popup.window);
- device = gtk_get_current_event_device ();
- if (device == NULL) {
- GdkDeviceManager *device_manager;
- GdkDisplay *display;
- GList *devices;
-
- display = gtk_widget_get_display (GTK_WIDGET (self));
- device_manager = gdk_display_get_device_manager (display);
- devices = gdk_device_manager_list_devices (device_manager, GDK_DEVICE_TYPE_MASTER);
- device = devices->data;
-
- g_list_free (devices);
- }
-
- if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD) {
- keyboard = device;
- pointer = gdk_device_get_associated_device (device);
- }
- else {
- pointer = device;
- keyboard = gdk_device_get_associated_device (device);
- }
-
- gtk_widget_grab_focus (self->priv->expanded_list.tree_view);
-
- if (_gth_tags_entry_grab_devices (gtk_widget_get_window (self->priv->popup.window),
- keyboard,
- pointer,
- NULL,
- GDK_CURRENT_TIME))
- {
- self->priv->popup.grab_pointer = pointer;
- self->priv->popup.grab_keyboard = keyboard;
- gtk_device_grab_add (self->priv->popup.window, self->priv->popup.grab_pointer, TRUE);
+ self->priv->popup.grab_device = gtk_get_current_event_device ();
+ grab_status = gdk_seat_grab (gdk_device_get_seat (self->priv->popup.grab_device),
+ gtk_widget_get_window (self->priv->popup.window),
+ GDK_SEAT_CAPABILITY_KEYBOARD | GDK_SEAT_CAPABILITY_ALL_POINTING,
+ TRUE,
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+ if (grab_status == GDK_GRAB_SUCCESS) {
+ gtk_widget_grab_focus (self->priv->expanded_list.tree_view);
+ gtk_device_grab_add (self->priv->popup.window, self->priv->popup.grab_device, TRUE);
}
}
@@ -1124,8 +1045,7 @@ gth_tags_entry_init (GthTagsEntry *self)
self->priv->expanded_list.last_used = g_new0 (char *, 1);
self->priv->expanded = FALSE;
self->priv->inconsistent = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
- self->priv->popup.grab_pointer = NULL;
- self->priv->popup.grab_keyboard = NULL;
+ self->priv->popup.grab_device = NULL;
/* entry / expander button box */
diff --git a/gthumb/gth-time-selector.c b/gthumb/gth-time-selector.c
index 4802248d..411d11b3 100644
--- a/gthumb/gth-time-selector.c
+++ b/gthumb/gth-time-selector.c
@@ -50,8 +50,7 @@ struct _GthTimeSelectorPrivate {
gboolean use_time;
gboolean optional_time;
gulong day_selected_event;
- GdkDevice *grab_pointer;
- GdkDevice *grab_keyboard;
+ GdkDevice *grab_device;
};
@@ -79,8 +78,13 @@ gth_time_selector_finalize (GObject *object)
static void
-_gth_time_selector_ungrab_devices (GthTimeSelector *self,
- guint32 time);
+_gth_time_selector_ungrab_devices (GthTimeSelector *self)
+{
+ if (self->priv->grab_device != NULL) {
+ gtk_device_grab_remove (self->priv->calendar_popup, self->priv->grab_device);
+ self->priv->grab_device = NULL;
+ }
+}
static void
@@ -89,7 +93,7 @@ gth_time_selector_unmap (GtkWidget *widget)
GthTimeSelector *self;
self = GTH_TIME_SELECTOR (widget);
- _gth_time_selector_ungrab_devices (self, GDK_CURRENT_TIME);
+ _gth_time_selector_ungrab_devices (self);
GTK_WIDGET_CLASS (gth_time_selector_parent_class)->unmap (widget);
}
@@ -130,23 +134,6 @@ gth_time_selector_class_init (GthTimeSelectorClass *class)
}
-static void
-_gth_time_selector_ungrab_devices (GthTimeSelector *self,
- guint32 time)
-{
- if (self->priv->grab_pointer != NULL) {
- gdk_device_ungrab (self->priv->grab_pointer, time);
- gtk_device_grab_remove (self->priv->calendar_popup, self->priv->grab_pointer);
- self->priv->grab_pointer = NULL;
- }
-
- if (self->priv->grab_keyboard != NULL) {
- gdk_device_ungrab (self->priv->grab_keyboard, time);
- self->priv->grab_keyboard = NULL;
- }
-}
-
-
static gboolean
_gth_time_selector_grab_broken_event (GtkWidget *widget,
GdkEventGrabBroken *event,
@@ -155,7 +142,7 @@ _gth_time_selector_grab_broken_event (GtkWidget *widget,
GthTimeSelector *self = user_data;
if (event->grab_window == NULL)
- _gth_time_selector_ungrab_devices (self, GDK_CURRENT_TIME);
+ _gth_time_selector_ungrab_devices (self);
return TRUE;
}
@@ -166,9 +153,18 @@ gth_time_selector_init (GthTimeSelector *self)
{
self->priv = gth_time_selector_get_instance_private (self);
self->priv->date_time = gth_datetime_new ();
+ self->priv->date_entry = NULL;
+ self->priv->calendar_button = NULL;
+ self->priv->calendar = NULL;
+ self->priv->calendar_popup = NULL;
+ self->priv->use_time_checkbutton = NULL;
+ self->priv->time_combo_box = NULL;
+ self->priv->popup_box = NULL;
+ self->priv->now_button = NULL;
self->priv->use_time = TRUE;
- self->priv->grab_pointer = NULL;
- self->priv->grab_keyboard = NULL;
+ self->priv->optional_time = FALSE;
+ self->priv->day_selected_event = 0;
+ self->priv->grab_device = NULL;
gtk_orientable_set_orientation (GTK_ORIENTABLE (self), GTK_ORIENTATION_HORIZONTAL);
@@ -182,53 +178,13 @@ gth_time_selector_init (GthTimeSelector *self)
static void
hide_calendar_popup (GthTimeSelector *self)
{
- _gth_time_selector_ungrab_devices (self, GDK_CURRENT_TIME);
+ _gth_time_selector_ungrab_devices (self);
gtk_widget_hide (self->priv->calendar_popup);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->priv->calendar_button), FALSE);
}
-static gboolean
-_gth_time_selector_grab_devices (GdkWindow *window,
- GdkDevice *keyboard,
- GdkDevice *pointer,
- GdkCursor *cursor,
- guint32 time)
-{
- if (keyboard != NULL) {
- if (gdk_device_grab (keyboard,
- window,
- GDK_OWNERSHIP_APPLICATION,
- TRUE,
- (GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK),
- NULL,
- time) != GDK_GRAB_SUCCESS)
- {
- return FALSE;
- }
- }
-
- if (pointer != NULL) {
- if (gdk_device_grab (pointer,
- window,
- GDK_OWNERSHIP_APPLICATION,
- TRUE,
- GDK_ALL_EVENTS_MASK,
- cursor,
- time) != GDK_GRAB_SUCCESS)
- {
- if (keyboard != NULL)
- gdk_device_ungrab (keyboard, time);
-
- return FALSE;
- }
- }
-
- return TRUE;
-}
-
-
static void
show_calendar_popup (GthTimeSelector *self)
{
@@ -238,9 +194,7 @@ show_calendar_popup (GthTimeSelector *self)
GtkAllocation allocation;
int selector_height;
GdkRectangle monitor;
- GdkDevice *device;
- GdkDevice *pointer;
- GdkDevice *keyboard;
+ GdkGrabStatus grab_status;
gtk_widget_get_preferred_size (self->priv->popup_box, &popup_req, NULL);
@@ -265,40 +219,18 @@ show_calendar_popup (GthTimeSelector *self)
gtk_window_move (GTK_WINDOW (self->priv->calendar_popup), x, y);
gtk_widget_show (self->priv->calendar_popup);
- device = gtk_get_current_event_device ();
- if (device == NULL) {
- GdkDeviceManager *device_manager;
- GdkDisplay *display;
- GList *devices;
-
- display = gtk_widget_get_display (GTK_WIDGET (self));
- device_manager = gdk_display_get_device_manager (display);
- devices = gdk_device_manager_list_devices (device_manager, GDK_DEVICE_TYPE_MASTER);
- device = devices->data;
-
- g_list_free (devices);
- }
-
- if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD) {
- keyboard = device;
- pointer = gdk_device_get_associated_device (device);
- }
- else {
- pointer = device;
- keyboard = gdk_device_get_associated_device (device);
- }
-
- gtk_widget_grab_focus (self->priv->calendar);
-
- if (_gth_time_selector_grab_devices (gtk_widget_get_window (self->priv->calendar_popup),
- keyboard,
- pointer,
- NULL,
- GDK_CURRENT_TIME))
- {
- self->priv->grab_pointer = pointer;
- self->priv->grab_keyboard = keyboard;
- gtk_device_grab_add (self->priv->calendar_popup, self->priv->grab_pointer, TRUE);
+ self->priv->grab_device = gtk_get_current_event_device ();
+ grab_status = gdk_seat_grab (gdk_device_get_seat (self->priv->grab_device),
+ gtk_widget_get_window (self->priv->calendar_popup),
+ GDK_SEAT_CAPABILITY_KEYBOARD | GDK_SEAT_CAPABILITY_ALL_POINTING,
+ TRUE,
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+ if (grab_status == GDK_GRAB_SUCCESS) {
+ gtk_widget_grab_focus (self->priv->calendar);
+ gtk_device_grab_add (self->priv->calendar_popup, self->priv->grab_device, TRUE);
}
}
diff --git a/gthumb/gtk-utils.c b/gthumb/gtk-utils.c
index 75ec9985..7470080f 100644
--- a/gthumb/gtk-utils.c
+++ b/gthumb/gtk-utils.c
@@ -329,7 +329,7 @@ show_help_dialog (GtkWindow *parent,
GError *error = NULL;
uri = g_strconcat ("help:gthumb", section ? "/" : NULL, section, NULL);
- if (! gtk_show_uri (gtk_window_get_screen (parent), uri, GDK_CURRENT_TIME, &error)) {
+ if (! gtk_show_uri_on_window (parent, uri, GDK_CURRENT_TIME, &error)) {
GtkWidget *dialog;
dialog = _gtk_message_dialog_new (parent,
@@ -532,21 +532,26 @@ _gtk_image_new_from_xpm_data (char * xpm_data[])
}
-void
+gboolean
_gtk_widget_get_screen_size (GtkWidget *widget,
int *width,
int *height)
{
- GdkScreen *screen;
- cairo_rectangle_int_t geometry;
+ GdkRectangle geometry;
+ gboolean success;
- screen = gtk_widget_get_screen (widget);
- gdk_screen_get_monitor_geometry (screen,
- gdk_screen_get_monitor_at_window (screen, gtk_widget_get_window
(widget)),
- &geometry);
+ if (_gtk_widget_get_monitor_geometry (widget, &geometry)) {
+ if (width != NULL) *width = geometry.width;
+ if (height != NULL) *height = geometry.height;
+ success = TRUE;
+ }
+ else {
+ if (width != NULL) *width = 0;
+ if (height != NULL) *height = 0;
+ success = FALSE;
+ }
- *width = geometry.width;
- *height = geometry.height;
+ return success;
}
@@ -673,10 +678,10 @@ void
_gtk_window_resize_to_fit_screen_height (GtkWidget *window,
int default_width)
{
- GdkScreen *screen;
+ int screen_height;
- screen = gtk_widget_get_screen (window);
- if ((screen != NULL) && (gdk_screen_get_height (screen) < 768))
+ _gtk_widget_get_screen_size (window, NULL, &screen_height);
+ if (screen_height < 768)
/* maximize on netbooks */
gtk_window_maximize (GTK_WINDOW (window));
else
@@ -749,8 +754,7 @@ _gtk_menu_ask_drag_drop_action_append_item (GtkWidget *menu,
GdkDragAction
_gtk_menu_ask_drag_drop_action (GtkWidget *widget,
- GdkDragAction actions,
- guint32 activate_time)
+ GdkDragAction actions)
{
DropActionData drop_data;
GtkWidget *menu;
@@ -787,17 +791,11 @@ _gtk_menu_ask_drag_drop_action (GtkWidget *widget,
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
g_signal_connect (menu,
- "deactivate",
- G_CALLBACK (ask_drag_drop_action_menu_deactivate_cb),
- &drop_data);
-
- gtk_menu_popup (GTK_MENU (menu),
- NULL,
- NULL,
- NULL,
- NULL,
- 0,
- activate_time);
+ "deactivate",
+ G_CALLBACK (ask_drag_drop_action_menu_deactivate_cb),
+ &drop_data);
+
+ gtk_menu_popup_at_pointer (GTK_MENU (menu), NULL);
gtk_grab_add (menu);
g_main_loop_run (drop_data.loop);
@@ -1221,42 +1219,39 @@ _gtk_window_get_monitor_info (GtkWindow *window,
}
-void
+gboolean
_gtk_widget_get_monitor_geometry (GtkWidget *widget,
GdkRectangle *geometry)
{
- GdkScreen *screen;
- int monitor_num;
- cairo_rectangle_int_t monitor;
+ gboolean result = FALSE;
+ GtkWidget *window;
- screen = gtk_widget_get_screen (widget);
- monitor_num = gdk_screen_get_monitor_at_window (screen, gtk_widget_get_window (widget));
- gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
-
- if (geometry != NULL) {
- geometry->x = monitor.x;
- geometry->y = monitor.y;
- geometry->width = monitor.width;
- geometry->height = monitor.height;
+ window = gtk_widget_get_toplevel (widget);
+ if (GTK_IS_WINDOW (window)) {
+ if (_gtk_window_get_monitor_info (GTK_WINDOW (window), geometry, NULL, NULL)) {
+ result = TRUE;
+ }
}
+
+ return result;
}
GdkDevice *
_gtk_widget_get_client_pointer (GtkWidget *widget)
{
- GdkDisplay *display;
- GdkDeviceManager *device_manager;
+ GdkDisplay *display;
+ GdkSeat *seat;;
display = gtk_widget_get_display (widget);
if (display == NULL)
return NULL;
- device_manager = gdk_display_get_device_manager (display);
- if (device_manager == NULL)
+ seat = gdk_display_get_default_seat (display);
+ if (seat == NULL)
return NULL;
- return gdk_device_manager_get_client_pointer (device_manager);
+ return gdk_seat_get_pointer (seat);
}
@@ -1298,3 +1293,15 @@ _gdk_cursor_new_for_widget (GtkWidget *widget,
{
return gdk_cursor_new_for_display (gtk_widget_get_display (widget), cursor_type);
}
+
+
+void
+_gtk_widget_reparent (GtkWidget *widget,
+ GtkWidget *new_parent)
+{
+ g_object_ref (widget);
+ gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (widget)), widget);
+ gtk_container_add (GTK_CONTAINER (new_parent), widget);
+ g_object_unref (widget);
+}
+
diff --git a/gthumb/gtk-utils.h b/gthumb/gtk-utils.h
index dd7dd37c..3897a5cf 100644
--- a/gthumb/gtk-utils.h
+++ b/gthumb/gtk-utils.h
@@ -108,7 +108,7 @@ void _gtk_combo_box_append_texts (GtkComboBoxText *co
const char *first_text,
...);
GtkWidget * _gtk_image_new_from_xpm_data (char *xpm_data[]);
-void _gtk_widget_get_screen_size (GtkWidget *widget,
+gboolean _gtk_widget_get_screen_size (GtkWidget *widget,
int *width,
int *height);
int _gtk_widget_get_allocated_width (GtkWidget *widget);
@@ -130,8 +130,7 @@ void _gtk_window_resize_to_fit_screen_height (GtkWidget *wi
int default_width);
void _gtk_info_bar_clear_action_area (GtkInfoBar *info_bar);
GdkDragAction _gtk_menu_ask_drag_drop_action (GtkWidget *widget,
- GdkDragAction actions,
- guint32 activate_time);
+ GdkDragAction actions);
gboolean _gdk_rgba_darker (GdkRGBA *color,
GdkRGBA *result);
gboolean _gdk_rgba_lighter (GdkRGBA *color,
@@ -158,13 +157,15 @@ gboolean _gtk_window_get_monitor_info (GtkWindow
*window,
GdkRectangle *geometry,
int *number,
char **name);
-void _gtk_widget_get_monitor_geometry (GtkWidget *widget,
+gboolean _gtk_widget_get_monitor_geometry (GtkWidget *widget,
GdkRectangle *geometry);
GdkDevice * _gtk_widget_get_client_pointer (GtkWidget *widget);
void _gtk_list_box_add_separator (GtkListBox *list_box);
gboolean _gtk_settings_get_dialogs_use_header (void);
GdkCursor * _gdk_cursor_new_for_widget (GtkWidget *widget,
GdkCursorType cursor_type);
+void _gtk_widget_reparent (GtkWidget *widget,
+ GtkWidget *new_parent);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]