[Xfce4-commits] <xfdesktop:eric/bugzilla-patches> Get correct workspace size with multimon display
Eric Koegel
noreply at xfce.org
Sat Mar 3 18:10:06 CET 2012
Updating branch refs/heads/eric/bugzilla-patches
to d3211fcb34491200bf60d1e38ace87f0ca8ee4c0 (commit)
from a18cb32c970f2355cfa86bf6763e31efa93e1df5 (commit)
commit d3211fcb34491200bf60d1e38ace87f0ca8ee4c0
Author: Eric Koegel <eric.koegel at gmail.com>
Date: Sat Mar 3 18:08:45 2012 +0300
Get correct workspace size with multimon display
When multiple montiors are used and a Virtual desktop size is
configured in Xorg, it will always return that size rather than
the actual size displayed. This patch changes how the size is
calculated so that icons stay in their location when the resolution
reverts back.
src/xfdesktop-file-icon-manager.c | 28 +++++++++++++++++++++++-----
src/xfdesktop-icon-view.c | 8 +-------
src/xfdesktop-icon-view.h | 8 ++++++++
3 files changed, 32 insertions(+), 12 deletions(-)
diff --git a/src/xfdesktop-file-icon-manager.c b/src/xfdesktop-file-icon-manager.c
index 9e90df7..0c6b244 100644
--- a/src/xfdesktop-file-icon-manager.c
+++ b/src/xfdesktop-file-icon-manager.c
@@ -1781,13 +1781,22 @@ xfdesktop_file_icon_manager_save_icons(gpointer user_data)
XfdesktopFileIconManager *fmanager = XFDESKTOP_FILE_ICON_MANAGER(user_data);
gchar relpath[PATH_MAX], *tmppath, *path;
XfceRc *rcfile;
+ gint x = 0, y = 0, width = 0, height = 0;
fmanager->priv->save_icons_id = 0;
-
+
+ xfdesktop_get_workarea_single(fmanager->priv->icon_view,
+ 0,
+ &x,
+ &y,
+ &width,
+ &height);
+
g_snprintf(relpath, PATH_MAX, "xfce4/desktop/icons.screen%d-%dx%d.rc",
gdk_screen_get_number(fmanager->priv->gscreen),
- gdk_screen_get_width(fmanager->priv->gscreen),
- gdk_screen_get_height(fmanager->priv->gscreen));
+ width,
+ height);
+
path = xfce_resource_save_location(XFCE_RESOURCE_CONFIG, relpath, TRUE);
if(!path)
return FALSE;
@@ -1853,11 +1862,20 @@ xfdesktop_file_icon_manager_get_cached_icon_position(XfdesktopFileIconManager *f
gchar relpath[PATH_MAX];
gchar *filename = NULL;
gboolean ret = FALSE;
+ gint x = 0, y = 0, width = 0, height = 0;
+
+ xfdesktop_get_workarea_single(fmanager->priv->icon_view,
+ 0,
+ &x,
+ &y,
+ &width,
+ &height);
g_snprintf(relpath, PATH_MAX, "xfce4/desktop/icons.screen%d-%dx%d.rc",
gdk_screen_get_number(fmanager->priv->gscreen),
- gdk_screen_get_width(fmanager->priv->gscreen),
- gdk_screen_get_height(fmanager->priv->gscreen));
+ width,
+ height);
+
filename = xfce_resource_lookup(XFCE_RESOURCE_CONFIG, relpath);
/* Check if we have to migrate from the old file format */
diff --git a/src/xfdesktop-icon-view.c b/src/xfdesktop-icon-view.c
index 868ba41..cf2e977 100644
--- a/src/xfdesktop-icon-view.c
+++ b/src/xfdesktop-icon-view.c
@@ -304,12 +304,6 @@ static void xfdesktop_screen_size_changed_cb(GdkScreen *gscreen,
static GdkFilterReturn xfdesktop_rootwin_watch_workarea(GdkXEvent *gxevent,
GdkEvent *event,
gpointer user_data);
-static gboolean xfdesktop_get_workarea_single(XfdesktopIconView *icon_view,
- guint ws_num,
- gint *xorigin,
- gint *yorigin,
- gint *width,
- gint *height);
static void xfdesktop_grid_do_resize(XfdesktopIconView *icon_view);
static inline gboolean xfdesktop_rectangle_contains_point(GdkRectangle *rect,
gint x,
@@ -3128,7 +3122,7 @@ xfdesktop_grid_resize_timeout(gpointer user_data)
}
-static gboolean
+gboolean
xfdesktop_get_workarea_single(XfdesktopIconView *icon_view,
guint ws_num,
gint *xorigin,
diff --git a/src/xfdesktop-icon-view.h b/src/xfdesktop-icon-view.h
index 95bddd4..f9f5cbf 100644
--- a/src/xfdesktop-icon-view.h
+++ b/src/xfdesktop-icon-view.h
@@ -118,6 +118,14 @@ gdouble xfdesktop_icon_view_get_font_size(XfdesktopIconView *icon_view);
GtkWidget *xfdesktop_icon_view_get_window_widget(XfdesktopIconView *icon_view);
+gboolean
+xfdesktop_get_workarea_single(XfdesktopIconView *icon_view,
+ guint ws_num,
+ gint *xorigin,
+ gint *yorigin,
+ gint *width,
+ gint *height);
+
void xfdesktop_icon_view_sort_icons(XfdesktopIconView *icon_view);
#if defined(DEBUG) && DEBUG > 0
More information about the Xfce4-commits
mailing list