Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 45cfa30
Author: Jose Maranan <[email protected]>
Date:   Wed Nov 3 11:30:54 2021 -0400

    Update issue templates

commit 71d98d1
Author: Jose Maranan <[email protected]>
Date:   Wed Nov 3 10:18:07 2021 -0400

    docs: update tests for drag/drop

commit d6400d4
Author: Jose Maranan <[email protected]>
Date:   Wed Nov 3 09:55:18 2021 -0400

    fix: update checking for mod keys using Clutter

    Fixes #74
  • Loading branch information
jmmaranan committed Nov 3, 2021
1 parent 4ada173 commit 99e8608
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 46 deletions.
37 changes: 37 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
name: Bug report
about: Create a report to help us improve
title: 'bug: short descript of issue'
labels: bug
assignees: ''

---

**Describe the bug/issue**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots or journal logs**
Provide screenshorts or screen captures if possible.
Also if possible, please provide latest logs from e.g. 1 hour ago `journalctl -b 0 -r --since "1 hour ago"`:

**Version Information**
1. Distro and version:
2. Forge version or from source (branch or commit)
3. Gnome-shell version (`gnome-shell --version`):

**Monitor Setup**
1. 2 x 1080p
2. Dual monitor vertical orientation, etc

**Additional context**
Add any other context about the problem here.
7 changes: 2 additions & 5 deletions TESTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,11 @@ When changing Preferences on Appearance > Colors:
## Tiling Mode

When dragging a window,
- [ ] - On dropping and _also_ pressing the Swap Modifier, should swap the windows.
- [ ] - On moving and _not_ pressing the Swap modifier, should show a preview hint where the window would be tiled.
- [ ] - Should show a preview hint where the window would be tiled. If Tile Modifier is set, Super or Ctrl or Alt would show preview otherwise shows preview automatically:
- [ ] - For split layout, should show preview hint left/right on horizontal, top/bottom on vertical following the mouse pointer.
- [ ] - For tabbed layout, should show preview hint same size as the current front window.
- [ ] - For stacked layout, should show preview hint same size as the current front window.
- [ ] - On moving and not pressing the Swap modifier, pressing ESC should cancel the drag/drop and dragged window should go back to its previous position.
- [ ] - On dropping and not pressing the Swap modifier, should tile the window on the preview hint position shown before dropping.
- [ ] - On moving, should update the focus hint position unless disabled.
- [ ] - On dropping, should tile the window on the preview hint position shown before dropping.
- [ ] - On dropping to a different monitor, should tile based on the preview hint position shown unless empty monitor.
- [ ] - Empty monitors will not show a preview hint.

Expand Down
60 changes: 20 additions & 40 deletions keybindings.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,50 +161,30 @@ var Keybindings = GObject.registerClass(
}
}

get keymap() {
const gdkDisplay = Gdk.DisplayManager.get().get_default_display();
const gdkKeyMap = Gdk.Keymap.get_for_display(gdkDisplay);
return gdkKeyMap;
}

get modifierState() {
return this.keymap.get_modifier_state();
const [_x, _y, state] = this.extWm.getPointer();
Logger.debug(`kbd: get mod state ${state}`);
return state;
}

allowDragDropTile() {
let tileModifier = this.kbdSettings.get_string("mod-mask-mouse-tile");
let tileModifierMask = ExtUtils.translateModifierType(tileModifier);
return this.modifierState === tileModifierMask;
}

isKeyPressed(mask) {
let modifierState = this.modifierState;
return modifierState === mask;
}

isSuperPressed() {
let mask = Gdk.ModifierType.MOD4_MASK;
return this.isKeyPressed(mask);
}

isCtrlPressed() {
let mask = Gdk.ModifierType.CONTROL_MASK;
return this.isKeyPressed(mask);
}

isAltPressed() {
let mask = Gdk.ModifierType.MOD1_MASK;
return this.isKeyPressed(mask);
}

isShiftPressed() {
let mask = Gdk.ModifierType.SHIFT_MASK;
return this.isKeyPressed(mask);
}

isNonePressed() {
let tileModifier = this.kbdSettings.get_string("mod-mask-mouse-tile");
return tileModifier === "None";
const tileModifier = this.kbdSettings.get_string("mod-mask-mouse-tile");
const modState = this.modifierState;
// Using Clutter.ModifierType values and also testing for pointer
// being grabbed (256). E.g. grabbed + pressing Super = 256 + 64 = 320
// See window.js#_handleMoving() - an overlay preview is shown.
// See window.js#_handleGrabOpEnd() - when the drag has been dropped
switch (tileModifier) {
case "Super":
return modState === 64 || modState === 320;
case "Alt":
return modState === 8 || modState === 264;
case "Ctrl":
return modState === 4 || modState === 260;
case "None":
return true;
}
return false;
}

buildBindingDefinitions() {
Expand Down
2 changes: 1 addition & 1 deletion window.js
Original file line number Diff line number Diff line change
Expand Up @@ -1643,7 +1643,7 @@ var WindowManager = GObject.registerClass(
}

allowDragDropTile() {
return this.kbd.allowDragDropTile() || this.kbd.isNonePressed();
return this.kbd.allowDragDropTile();
}

_handleResizing(focusNodeWindow) {
Expand Down

0 comments on commit 99e8608

Please sign in to comment.