[gthumb] fixed fullscreen toolbars with multiple monitors
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] fixed fullscreen toolbars with multiple monitors
- Date: Wed, 13 Jun 2012 12:37:16 +0000 (UTC)
commit 376b88aa764831574aea492d78362fb015ce8f8d
Author: Paolo Bacchilega <paobac src gnome org>
Date: Wed Jun 13 13:37:52 2012 +0200
fixed fullscreen toolbars with multiple monitors
keep the toolbars on the main window monitor
extensions/gstreamer_tools/gth-media-viewer-page.c | 20 ++++++---
gthumb/gth-browser.c | 44 ++++++++++++++++----
2 files changed, 48 insertions(+), 16 deletions(-)
---
diff --git a/extensions/gstreamer_tools/gth-media-viewer-page.c b/extensions/gstreamer_tools/gth-media-viewer-page.c
index 5518417..3da7865 100644
--- a/extensions/gstreamer_tools/gth-media-viewer-page.c
+++ b/extensions/gstreamer_tools/gth-media-viewer-page.c
@@ -1230,7 +1230,8 @@ gth_media_viewer_page_real_fullscreen (GthViewerPage *base,
{
GthMediaViewerPage *self = (GthMediaViewerPage*) base;
GdkScreen *screen;
- GtkAllocation allocation;
+ int n_monitor;
+ GdkRectangle work_area;
if (! active) {
remove_fullscreen_toolbar (self);
@@ -1240,11 +1241,11 @@ gth_media_viewer_page_real_fullscreen (GthViewerPage *base,
/* active == TRUE */
screen = gtk_widget_get_screen (GTK_WIDGET (self->priv->browser));
+ n_monitor = gdk_screen_get_monitor_at_window (screen, gtk_widget_get_window (GTK_WIDGET (self->priv->browser)));
+ gdk_screen_get_monitor_geometry (screen, n_monitor, &work_area);
if (self->priv->fullscreen_toolbar == NULL) {
self->priv->fullscreen_toolbar = gtk_window_new (GTK_WINDOW_POPUP);
- gtk_window_set_screen (GTK_WINDOW (self->priv->fullscreen_toolbar), screen);
- gtk_window_set_default_size (GTK_WINDOW (self->priv->fullscreen_toolbar), gdk_screen_get_width (screen), -1);
gtk_container_set_border_width (GTK_CONTAINER (self->priv->fullscreen_toolbar), 0);
}
@@ -1255,10 +1256,15 @@ gth_media_viewer_page_real_fullscreen (GthViewerPage *base,
g_object_unref (self->priv->mediabar);
}
- gtk_widget_realize (self->priv->mediabar);
- gtk_window_set_gravity (GTK_WINDOW (self->priv->fullscreen_toolbar), GDK_GRAVITY_SOUTH_EAST);
- gtk_widget_get_allocation (self->priv->mediabar, &allocation);
- gtk_window_move (GTK_WINDOW (self->priv->fullscreen_toolbar), 0, gdk_screen_get_height (screen) - allocation.height);
+ gtk_widget_realize (self->priv->fullscreen_toolbar);
+
+ gtk_window_set_screen (GTK_WINDOW (self->priv->fullscreen_toolbar), screen);
+ gtk_window_resize (GTK_WINDOW (self->priv->fullscreen_toolbar),
+ work_area.width,
+ gtk_widget_get_allocated_height (self->priv->fullscreen_toolbar));
+ gtk_window_move (GTK_WINDOW (self->priv->fullscreen_toolbar),
+ work_area.x,
+ work_area.height - gtk_widget_get_allocated_height (self->priv->fullscreen_toolbar));
gth_browser_register_fullscreen_control (self->priv->browser, self->priv->fullscreen_toolbar);
}
diff --git a/gthumb/gth-browser.c b/gthumb/gth-browser.c
index 0c08001..544d530 100644
--- a/gthumb/gth-browser.c
+++ b/gthumb/gth-browser.c
@@ -6170,22 +6170,36 @@ gth_browser_unregister_fullscreen_control (GthBrowser *browser,
static void
-_gth_browser_create_fullscreen_toolbar (GthBrowser *browser)
+_gth_browser_move_fullscreen_toolbar (GthBrowser *browser)
{
- GdkScreen *screen;
-
- if (browser->priv->fullscreen_toolbar != NULL)
- return;
+ GdkScreen *screen;
+ int n_monitor;
+ GdkRectangle work_area;
- browser->priv->fullscreen_toolbar = gtk_window_new (GTK_WINDOW_POPUP);
+ gtk_widget_realize (browser->priv->fullscreen_toolbar);
screen = gtk_widget_get_screen (GTK_WIDGET (browser));
+ n_monitor = gdk_screen_get_monitor_at_window (screen, gtk_widget_get_window (GTK_WIDGET (browser)));
+ gdk_screen_get_monitor_geometry (screen, n_monitor, &work_area);
+
gtk_window_set_screen (GTK_WINDOW (browser->priv->fullscreen_toolbar), screen);
- gtk_window_set_default_size (GTK_WINDOW (browser->priv->fullscreen_toolbar), gdk_screen_get_width (screen), -1);
- gtk_container_set_border_width (GTK_CONTAINER (browser->priv->fullscreen_toolbar), 0);
+ gtk_window_resize (GTK_WINDOW (browser->priv->fullscreen_toolbar),
+ work_area.width,
+ gtk_widget_get_allocated_height (browser->priv->fullscreen_toolbar));
+ gtk_window_move (GTK_WINDOW (browser->priv->fullscreen_toolbar), work_area.x, work_area.y);
+}
- gtk_container_add (GTK_CONTAINER (browser->priv->fullscreen_toolbar), gtk_ui_manager_get_widget (browser->priv->ui, "/Fullscreen_ToolBar"));
+static void
+_gth_browser_create_fullscreen_toolbar (GthBrowser *browser)
+{
+ if (browser->priv->fullscreen_toolbar != NULL)
+ return;
+
+ browser->priv->fullscreen_toolbar = gtk_window_new (GTK_WINDOW_POPUP);
+ gtk_container_set_border_width (GTK_CONTAINER (browser->priv->fullscreen_toolbar), 0);
+ gtk_container_add (GTK_CONTAINER (browser->priv->fullscreen_toolbar),
+ gtk_ui_manager_get_widget (browser->priv->ui, "/Fullscreen_ToolBar"));
gth_browser_register_fullscreen_control (browser, browser->priv->fullscreen_toolbar);
}
@@ -6202,6 +6216,9 @@ hide_mouse_pointer_cb (gpointer data)
HideMouseData *hmdata = data;
GthBrowser *browser = hmdata->browser;
int px, py;
+ GdkScreen *screen;
+ int n_monitor;
+ GdkRectangle work_area;
GList *scan;
gdk_window_get_device_position (gtk_widget_get_window (GTK_WIDGET (browser)),
@@ -6209,6 +6226,14 @@ hide_mouse_pointer_cb (gpointer data)
&px,
&py,
0);
+
+ screen = gtk_widget_get_screen (GTK_WIDGET (browser));
+ n_monitor = gdk_screen_get_monitor_at_window (screen, gtk_widget_get_window (GTK_WIDGET (browser)));
+ gdk_screen_get_monitor_geometry (screen, n_monitor, &work_area);
+
+ px += work_area.x;
+ py += work_area.y;
+
for (scan = browser->priv->fullscreen_controls; scan; scan = scan->next) {
GtkWidget *widget = scan->data;
int x, y, w, h;
@@ -6311,6 +6336,7 @@ gth_browser_fullscreen (GthBrowser *browser)
_gth_browser_set_thumbnail_list_visibility (browser, FALSE);
gth_window_set_current_page (GTH_WINDOW (browser), GTH_BROWSER_PAGE_VIEWER);
gth_window_show_only_content (GTH_WINDOW (browser), TRUE);
+ _gth_browser_move_fullscreen_toolbar (browser);
browser->priv->properties_on_screen = FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]