Bug 1403708 - wmctrl can't move floating windows in some circumstances
Summary: wmctrl can't move floating windows in some circumstances
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: wmctrl
Version: 28
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Jens Petersen
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-12-12 09:09 UTC by Bob Hepple
Modified: 2019-05-28 19:33 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-05-28 19:33:50 UTC
Type: Bug


Attachments (Terms of Use)

Description Bob Hepple 2016-12-12 09:09:18 UTC
Description of problem:

Version-Release number of selected component (if applicable):
wmctrl-1.07-19.fc24.x86_64

How reproducible:
Perfectly

Steps to Reproduce:
1. When using a WM which does not support the _NET_MOVERESIZE_WINDOW mechanism (eg i3wm), if window-id 0x1800007 (determined by xwininfo) refers to a window, then:

wmctrl -i -r 0x1800007 -e 0,0,0,-1,-1 # window moves
wmctrl -i -r 0x1800007 -e 0,0,-1,-1,-1 # window does not move

Both commands move the window when using fluxbox.

More information (including a fix) is posted here: https://github.com/i3/i3/issues/2601

Comment 1 Jens Petersen 2016-12-13 07:33:32 UTC
If a good patch can be made I don't mind including it in Fedora.
As far as I know upstream development has stopped.
Nice that i3 may get _NET_MOVERESIZE_WINDOW.

Comment 2 Bob Hepple 2016-12-18 09:43:05 UTC
Not sure that this is a _good_ patch but it more or less works on i3 inasmuch as it's no worse and a little better!!

the 'better' part is that window moves (my original complaint) now work.

the 'no worse' part reflects another bug in the original program - a resize takes 2 attempts to actually work! This patch does not fix that and may reveal a bug in XResizeWindow() (hard to believe!!). 

In the mixed 'move and resize' I just don't know why I had to get the parent window geometry - suffice to say, doing XGetGeometry() on the immediate window id (as returned by xwininfo) does not get what we need. I'm no expert on X intrinsics so can't comment more.

Anyways, the following patch only affects WMs that do not honour _NET_MOVERESIZE_WINDOW such as i3 so it's unlikely to have wide implications.

wmctrl-net_moveresize.patch:

diff -Naur wmctrl-1.07.orig/main.c wmctrl-1.07/main.c
--- wmctrl-1.07.orig/main.c     2005-01-29 13:31:33.000000000 +1000
+++ wmctrl-1.07/main.c  2016-12-18 19:23:39.993322856 +1000
@@ -861,14 +861,30 @@
     }
     else {
         p_verbose("WM doesn't support _NET_MOVERESIZE_WINDOW. Gravity will be ignored.\n");
-        if ((w < 1 || h < 1) && (x >= 0 && y >= 0)) {
+        Window root, parent, *children;
+        int old_x, old_y;
+        unsigned int old_w, old_h, border, depth, nchildren;
+        
+        if ((w < 1 && h < 1) && (x >= 0 && y >= 0)) {
+            /* pure move */
             XMoveWindow(disp, win, x, y);
         }
-        else if ((x < 0 || y < 0) && (w >= 1 && h >= -1)) {
+        else if ((x < 0 && y < 0) && (w >= 1 && h >= 1)) {
+            /* pure resize */
             XResizeWindow(disp, win, w, h);
         }
-        else if (x >= 0 && y >= 0 && w >= 1 && h >= 1) {
-            XMoveResizeWindow(disp, win, x, y, w, h);
+        else {
+            /* move and resize */
+            XQueryTree(disp, win, &root, &parent, &children, &nchildren);
+            XGetGeometry(disp, parent, &root, &old_x, &old_y, &old_w, &old_h, &border, &depth);
+
+            if (x < 0) x = old_x;
+            if (y < 0) y = old_y;
+            if (w < 0) w = old_w;
+            if (h < 0) h = old_h;
+
+            if ( x != old_x || y != old_y || w != old_w || h != old_h )
+                XMoveResizeWindow(disp, win, (int)x, (int)y, (unsigned int)w, (unsigned int)h);
         }
         return EXIT_SUCCESS;
     }

Comment 3 Fedora End Of Life 2017-07-26 00:04:17 UTC
This message is a reminder that Fedora 24 is nearing its end of life.
Approximately 2 (two) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 24. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '24'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 24 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 4 Bob Hepple 2017-07-27 09:40:20 UTC
Reconfirmed on F25 under i3wm

Comment 5 Fedora End Of Life 2017-11-16 19:47:52 UTC
This message is a reminder that Fedora 25 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 25. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '25'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 25 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 6 Fedora End Of Life 2017-12-12 10:43:34 UTC
Fedora 25 changed to end-of-life (EOL) status on 2017-12-12. Fedora 25 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 7 Fedora End Of Life 2018-02-20 15:28:52 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 28 development cycle.
Changing version to '28'.

Comment 8 Ben Cotton 2019-05-02 19:21:57 UTC
This message is a reminder that Fedora 28 is nearing its end of life.
On 2019-May-28 Fedora will stop maintaining and issuing updates for
Fedora 28. It is Fedora's policy to close all bug reports from releases
that are no longer maintained. At that time this bug will be closed as
EOL if it remains open with a Fedora 'version' of '28'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 28 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 9 Ben Cotton 2019-05-02 22:05:19 UTC
This message is a reminder that Fedora 28 is nearing its end of life.
On 2019-May-28 Fedora will stop maintaining and issuing updates for
Fedora 28. It is Fedora's policy to close all bug reports from releases
that are no longer maintained. At that time this bug will be closed as
EOL if it remains open with a Fedora 'version' of '28'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 28 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 10 Ben Cotton 2019-05-28 19:33:50 UTC
Fedora 28 changed to end-of-life (EOL) status on 2019-05-28. Fedora 28 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.