mirror of
https://github.com/gosticks/PaperWM.git
synced 2026-06-28 13:10:05 +00:00
getModiferState: always return 0 on X11
The clutter reported modifier state is easily stuck on X11: - Enter "clutter mode". Press and hold ctrl whild exiting (usually ctrl-ecs) - Clutter will now report ctrl after ctrl is released causing windows to go directly to dnd mode when moved.
This commit is contained in:
@@ -294,3 +294,5 @@ To turn on off without disrupting flow too much use ~GLib.setenv("CLUTTER_SHOW_F
|
||||
** Focus and active workspace
|
||||
It's not possible the have a focused window which doesn't belong to the active workspace
|
||||
~global.display.focus_window.workspace === workspaceManger.get_active_workspace()~
|
||||
* Clutter animation
|
||||
~time: 0~ does not result in an instant animation. A default duration seems to be selected instead.
|
||||
|
||||
11
tiling.js
11
tiling.js
@@ -2706,16 +2706,7 @@ function grabBegin(metaWindow, type) {
|
||||
case Meta.GrabOp.MOVING:
|
||||
inGrab = new Extension.imports.grab.MoveGrab(metaWindow, type);
|
||||
|
||||
let d;
|
||||
if (Clutter.DeviceManager) {
|
||||
let dm = Clutter.DeviceManager.get_default();
|
||||
d = dm.get_core_device(Clutter.InputDeviceType.KEYBOARD_DEVICE);
|
||||
} else {
|
||||
let backend = Clutter.get_default_backend()
|
||||
let seat = backend.get_default_seat()
|
||||
d = seat.get_keyboard()
|
||||
}
|
||||
if (d.get_modifier_state() & Clutter.ModifierType.CONTROL_MASK) {
|
||||
if (utils.getModiferState() & Clutter.ModifierType.CONTROL_MASK) {
|
||||
inGrab.begin();
|
||||
inGrab.beginDnD();
|
||||
} else if (inGrab.initialSpace && inGrab.initialSpace.indexOf(metaWindow) > -1) {
|
||||
|
||||
33
utils.js
33
utils.js
@@ -80,6 +80,16 @@ function ppEnumValue(value, genum) {
|
||||
}
|
||||
}
|
||||
|
||||
function ppModiferState(state) {
|
||||
let mods = [];
|
||||
for (let [mod, mask] of Object.entries(imports.gi.Clutter.ModifierType)) {
|
||||
if (mask & state) {
|
||||
mods.push(mod);
|
||||
}
|
||||
}
|
||||
return mods.join(", ")
|
||||
}
|
||||
|
||||
/**
|
||||
* Look up the function by name at call time. This makes it convenient to
|
||||
* redefine the function without re-registering all signal handler, keybindings,
|
||||
@@ -264,6 +274,29 @@ function warpPointer(x, y) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return current modifiers state (or'ed Clutter.ModifierType.*)
|
||||
* NB: Only on wayland. (Returns 0 on X11)
|
||||
*
|
||||
* Note: It's possible to get the modifier state through Gdk on X11, but move
|
||||
* grabs is not triggered when ctrl is held down, making it useless for our purpose atm.
|
||||
*/
|
||||
function getModiferState() {
|
||||
if (!Meta.is_wayland_compositor())
|
||||
return 0;
|
||||
|
||||
let keyboard;
|
||||
if (Clutter.DeviceManager) {
|
||||
let dm = Clutter.DeviceManager.get_default();
|
||||
keyboard = dm.get_core_device(Clutter.InputDeviceType.KEYBOARD_DEVICE);
|
||||
} else {
|
||||
let backend = Clutter.get_default_backend();
|
||||
let seat = backend.get_default_seat();
|
||||
keyboard = seat.get_keyboard();
|
||||
}
|
||||
return keyboard.get_modifier_state();
|
||||
}
|
||||
|
||||
function monitorOfPoint(x, y) {
|
||||
// get_monitor_index_for_rect "helpfully" returns the primary monitor index for out of bounds rects..
|
||||
const Main = imports.ui.main;
|
||||
|
||||
Reference in New Issue
Block a user