GNOME Bugzilla – Bug 344424
Negative geometry offsets are not respected
Last modified: 2006-06-09 17:29:39 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 ();
Sorry but you were beaten to this. I'll do a new release soon. *** This bug has been marked as a duplicate of 330067 ***