After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 344424 - Negative geometry offsets are not respected
Negative geometry offsets are not respected
Status: RESOLVED DUPLICATE of bug 330067
Product: devilspie
Classification: Other
Component: general
0.17
Other All
: Normal normal
: ---
Assigned To: Devilspie Maintainers
Devilspie Maintainers
Depends on:
Blocks:
 
 
Reported: 2006-06-09 17:16 UTC by Alec Thomas
Modified: 2006-06-09 17:29 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Alec Thomas 2006-06-09 17:16:25 UTC
Please describe the problem:
Negative geometry offsets such as -0+0 are ignored, and always treated as positive offsets from the top left corner rather than relative offsets.


Steps to reproduce:
1. Add a matcher (geometry "-0+0")
2. Start devilspie
3. 


Actual results:
Window is moved to top left corner

Expected results:
Window appear in top right corner

Does this happen every time?
Yes

Other information:
This patch works for me (YMMV). I attempted to use wnck_screen_get_active_workspace() but it always returned NULL.

diff -ru devilspie-0.17.1/src/actions.c devilspie-0.17.1-patched/src/actions.c
--- devilspie-0.17.1/src/actions.c  2005-10-21 19:58:14.000000000 +1000
+++ devilspie-0.17.1-patched/src/actions.c  2006-06-10 03:03:38.000000000 +1000
@@ -92,25 +92,36 @@
  * Set position + size of current window.
  */
 ESExpResult *func_geometry(ESExp *f, int argc, ESExpResult **argv, Context *c) {
-  gint xoffset, yoffset, width, height;
+  gint xoffset, yoffset, width, height, workspace_width = 1920, workspace_height = 1200;
   int retmask, new_xoffset, new_yoffset;
   unsigned int new_width, new_height;
+  WnckScreen *screen;
+  WnckWorkspace *workspace;

   if (argc < 1 || argv[0]->type != ESEXP_RES_STRING)
     return e_sexp_result_new_bool (f, FALSE);

   /* read in old geom + parse param */
+  screen           = wnck_window_get_screen (c->window);
+  workspace        = wnck_screen_get_workspace (screen, 0);
+  workspace_width  = wnck_workspace_get_width  (workspace);
+  workspace_height = wnck_workspace_get_height (workspace);
   wnck_window_get_geometry (c->window,
                             &xoffset, &yoffset, &width, &height);
+
   retmask = XParseGeometry (argv[0]->value.string,
                             &new_xoffset, &new_yoffset,
                             &new_width, &new_height);

   /* check which values to modify */
-  new_xoffset = (retmask & XValue)      ? new_xoffset : xoffset;
-  new_yoffset = (retmask & YValue)      ? new_yoffset : yoffset;
   new_width   = (retmask & WidthValue)  ? new_width   : width;
   new_height  = (retmask & HeightValue) ? new_height  : height;
+  new_xoffset = (retmask & XValue)      ? new_xoffset : xoffset;
+  if (retmask & XNegative)
+   new_xoffset = workspace_width - new_width - new_xoffset;
+  new_yoffset = (retmask & YValue)      ? new_yoffset : yoffset;
+  if (retmask & YNegative)
+   new_yoffset = workspace_height - new_height - new_yoffset;

   /* try to set new position.. */
   my_wnck_error_trap_push ();
Comment 1 Ross Burton 2006-06-09 17:29:39 UTC
Sorry but you were beaten to this.  I'll do a new release soon.

*** This bug has been marked as a duplicate of 330067 ***