Ctrl+[Movement Keys] changes virtual desktop #9

Merged
MicheleC merged 3 commits from issue/2 into master 3 years ago
Collaborator

Current bugs:

Current bugs: * Issue #10
blu.256 added 2 commits 3 years ago
a857ed1c14
Added appropriate event handler in KomposeFullscreenWidget.
cc13befa92
Copied focusNeighbourChild with slight modifications.
blu.256 added 1 commit 3 years ago
d5db6c5c25
Implemented special activation functions.
blu.256 force-pushed issue/2 from d5db6c5c25 to cc13befa92 3 years ago
blu.256 added 1 commit 3 years ago
b5e39bb95f
Added special setActive() and setInactive() functions.
blu.256 added 1 commit 3 years ago
24c6b74209
Storing active virtual desktop in a variable is more reliable
Owner

Hi Philippe,
sorry for the late response. I tested the code, it seems to work fine in most cases, using CTRL+movement keys changes the virtual desktop.

Some comments:

  1. it seems there is a small bug. I have 4 virtual desktops in 2x2 configuration. If I show all four desktops, movement works as expected.
    If I enable "Layout empty virtual desktops minimized" in the settings and I have windows only on destop 1 and 2 (top row), then moving down from virtual desktop 2 ends up in desktop 3 instead of 4. Viceversa (3 -> 2 when going up) also happens. And Ctrl+J/Down arrow from virtual desktop 4 goes to desktop 1. This does not seem to happen when that option is not enable or when there are windows on all desktop, so no desktop is minimized.

  2. after we change virtual desktop, it would be nice to automatically select a window to start from, without the need to press the movement keys again. This could be addressed on a separate PR is you want.

Thanks for the great work!!

Hi Philippe, sorry for the late response. I tested the code, it seems to work fine in most cases, using CTRL+movement keys changes the virtual desktop. Some comments: 1) it seems there is a small bug. I have 4 virtual desktops in 2x2 configuration. If I show all four desktops, movement works as expected. If I enable "Layout empty virtual desktops minimized" in the settings and I have windows only on destop 1 and 2 (top row), then moving down from virtual desktop 2 ends up in desktop 3 instead of 4. Viceversa (3 -> 2 when going up) also happens. And Ctrl+J/Down arrow from virtual desktop 4 goes to desktop 1. This does not seem to happen when that option is not enable or when there are windows on all desktop, so no desktop is minimized. 2) after we change virtual desktop, it would be nice to automatically select a window to start from, without the need to press the movement keys again. This could be addressed on a separate PR is you want. Thanks for the great work!!
Poster
Collaborator

Hello Michele,

I have been working on another small bug (which turned out to be a little tricky), which is when a window of a virtual desktop is selected, the virtual desktop highlight/focus is lost and always reverts to the first desktop.

Apropos 1: Confirmed.

Apropos 2: This seems too trivial to create a separate PR.

Thanks for testing the changes.

Hello Michele, I have been working on another small bug (which turned out to be a little tricky), which is when a window of a virtual desktop is selected, the virtual desktop highlight/focus is lost and always reverts to the first desktop. Apropos 1: Confirmed. Apropos 2: This seems too trivial to create a separate PR. Thanks for testing the changes.
blu.256 added 2 commits 3 years ago
04447ac149
Added first window autofocus on switch.
4e5e42791e
Independent focus for virtual desktops.
Poster
Collaborator

when a window of a virtual desktop is selected, the virtual desktop highlight/focus is lost and always reverts to the first desktop.

Resolved with commit 04447ac149.

after we change virtual desktop, it would be nice to automatically select a window to start from, without the need to press the movement keys again. This could be addressed on a separate PR is you want.

Resolved with commit 4e5e32791e.

> when a window of a virtual desktop is selected, the virtual desktop highlight/focus is lost and always reverts to the first desktop. Resolved with commit [04447ac149](https://mirror.git.trinitydesktop.org/gitea/TDE/kompose/commit/04447ac1499fae40937b95fcbfd5048083a8b471). > after we change virtual desktop, it would be nice to automatically select a window to start from, without the need to press the movement keys again. This could be addressed on a separate PR is you want. Resolved with commit [4e5e32791e](https://mirror.git.trinitydesktop.org/gitea/TDE/kompose/commit/4e5e42791e39b75c1354d3174ffb3edf473d28fd).
Owner

Tested the new version and works well.
Now only point 1. from my previous commit remains to be solved, then we can merge.
Thanks for the good work!

Tested the new version and works well. Now only point 1. from my previous commit remains to be solved, then we can merge. Thanks for the good work!
blu.256 force-pushed issue/2 from 4e5e42791e to 420af893f8 3 years ago
blu.256 changed title from WIP: Ctrl+[Movement Keys] changes virtual desktop to Ctrl+[Movement Keys] changes virtual desktop 3 years ago
Poster
Collaborator

@MicheleC The PR is ready to be merged. I've pushed a commit to disable the intimidating option and created a separate issue for point 1 (#10). When it is solved then we can revert that commit and thus restore the option. What do you think?

@MicheleC The PR is ready to be merged. I've pushed a commit to disable the intimidating option and created a separate issue for point 1 (#10). When it is solved then we can revert that commit and thus restore the option. What do you think?
MicheleC requested changes 3 years ago
MicheleC left a comment
Owner

The idea of disabling the checkbox till we fix the bug is good. Nevertheless with the original code in the PR, empty virtual desktops are always minimized.
We need to use the generic layout to avoid doing that.

The idea of disabling the checkbox till we fix the bug is good. Nevertheless with the original code in the PR, empty virtual desktops are always minimized. We need to use the generic layout to avoid doing that.
if ( t == TLAYOUT_TASKCONTAINERS &&
!KomposeSettings::instance()->getDynamicVirtDeskLayout() )
t = TLAYOUT_GENERIC;
*/
Owner

Needs to be something like this, to work correctly.

    t = TLAYOUT_GENERIC;
    layoutType = t;
  */
  layoutType = TLAYOUT_GENERIC;
}
Needs to be something like this, to work correctly. ``` t = TLAYOUT_GENERIC; layoutType = t; */ layoutType = TLAYOUT_GENERIC; } ```
Poster
Collaborator

Done.

Done.
blu.256 marked this conversation as resolved
Owner

@blu256
Could you please test if the proposed fix in the commnet above also work for you? With the original code I always had empty desktops minimized, meaning the bug was always there.

@blu256 Could you please test if the proposed fix in the commnet above also work for you? With the original code I always had empty desktops minimized, meaning the bug was always there.
blu.256 force-pushed issue/2 from 420af893f8 to 48f570eda8 3 years ago
Poster
Collaborator

@MicheleC I tested the proposed changes and it worked. Thanks!

@MicheleC I tested the proposed changes and it worked. Thanks!
MicheleC requested changes 3 years ago
MicheleC left a comment
Owner

Functionality-wise it is ok! Thanks for the good work.
Code wise there are a couple of things we can improve.

Functionality-wise it is ok! Thanks for the good work. Code wise there are a couple of things we can improve.
#include <kdebug.h>
#include <krootpixmap.h>
static bool controlHold = false; // is the control key pressed
Owner

I had a look through the code, I can't find any usage for this controlHold variable declared in this file. There is another static bool controlHold defined in src/komposetaskcontainerwidget.cpp and used in that file, but this one seems not used at all.
I have rebuilt and tested without this one and the behaviour seems the same.

I had a look through the code, I can't find any usage for this controlHold variable declared in this file. There is another static bool controlHold defined in src/komposetaskcontainerwidget.cpp and used in that file, but this one seems not used at all. I have rebuilt and tested without this one and the behaviour seems the same.
blu.256 marked this conversation as resolved
{
if ( e->key() == TQt::Key_Control )
{
controlHold = true;
Owner

Line with 'controlHold' is not required (see above)

Line with 'controlHold' is not required (see above)
blu.256 marked this conversation as resolved
else if ( e->key() == TQt::Key_Control )
{
controlHold = false;
Owner

Line with 'controlHold' is not required (see above)

Line with 'controlHold' is not required (see above)
blu.256 marked this conversation as resolved
switch( e->key() )
{
case TQt::Key_Right:
direction = DLAYOUT_RIGHT;
Owner

The first 3 cases could be grouped together, less code and no possibility of different behavior by mistake from different keys.

    case TQt::Key_Right:
    case TQt::Key_D:
    case TQt::Key_L:
      direction = DLAYOUT_RIGHT;
      break;

Same applies for the other 9 cases (3 groups of 3 cases each)

The first 3 cases could be grouped together, less code and no possibility of different behavior by mistake from different keys. ``` case TQt::Key_Right: case TQt::Key_D: case TQt::Key_L: direction = DLAYOUT_RIGHT; break; ``` Same applies for the other 9 cases (3 groups of 3 cases each)
blu.256 marked this conversation as resolved
blu.256 added 1 commit 3 years ago
df8c25b1f2
Code cleanup
blu.256 force-pushed issue/2 from df8c25b1f2 to 539e15a523 3 years ago
MicheleC approved these changes 3 years ago
MicheleC left a comment
Owner

Looks good 👍

Looks good :+1:
MicheleC merged commit 539e15a523 into master 3 years ago
MicheleC deleted branch issue/2 3 years ago
Owner

Merged and backported. Thanks Philippe!

Merged and backported. Thanks Philippe!
SlavekB added this to the R14.0.10 release milestone 3 years ago

Reviewers

MicheleC approved these changes 3 years ago
The pull request has been merged as 539e15a523.
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: TDE/kompose#9
Loading…
There is no content yet.