(ext)
| 708 | |
| 709 | |
| 710 | var DefaultTilingStrategy = function (ext){ |
| 711 | |
| 712 | this.extension = ext; |
| 713 | this.log = Log.getLogger("DefaultTilingStrategy"); |
| 714 | this.lastTime = null; |
| 715 | this.lastTimeCtrlPressed = null; |
| 716 | this.lastTimeShiftPressed = null; |
| 717 | |
| 718 | this.preview = new St.BoxLayout({ |
| 719 | style_class: 'tile-preview' |
| 720 | }); |
| 721 | this.preview_for_edge_tiling = false; |
| 722 | this.preview.visible = false; |
| 723 | Main.uiGroup.add_actor(this.preview); |
| 724 | var default_modifier = Gdk.Keymap.get_default(); |
| 725 | |
| 726 | |
| 727 | |
| 728 | this.is_ctrl_pressed = function (){ |
| 729 | //this.log.debug("Modifier key: " + this.extension.tile_modifier_key); |
| 730 | var modifiers = Clutter.ModifierType.CONTROL_MASK; // Default: Ctrl only |
| 731 | if (this.extension.tile_modifier_key === 'Super') |
| 732 | modifiers = Clutter.ModifierType.MOD4_MASK; |
| 733 | if (this.extension.tile_modifier_key === 'Ctrl or Super') |
| 734 | modifiers = modifiers | Clutter.ModifierType.MOD4_MASK; |
| 735 | var ret = default_modifier.get_modifier_state() & modifiers; |
| 736 | |
| 737 | if (ret){ |
| 738 | this.lastTimeCtrlPressed = new Date().getTime(); |
| 739 | } else { |
| 740 | var currTime = new Date().getTime(); |
| 741 | if (this.lastTimeCtrlPressed && (currTime - this.lastTimeCtrlPressed) < 500){ |
| 742 | ret = true; |
| 743 | } |
| 744 | } |
| 745 | return ret; |
| 746 | } |
| 747 | |
| 748 | this.is_shift_pressed = function (){ |
| 749 | let [x, y, mods] = global.get_pointer(); |
| 750 | var ret = mods & Clutter.ModifierType.SHIFT_MASK; |
| 751 | if (ret){ |
| 752 | this.lastTimeShiftPressed = new Date().getTime(); |
| 753 | } else { |
| 754 | var currTime = new Date().getTime(); |
| 755 | if (this.lastTimeShiftPressed && (currTime - this.lastTimeShiftPressed) < 500){ |
| 756 | ret = true; |
| 757 | } |
| 758 | } |
| 759 | return ret; |
| 760 | } |
| 761 | |
| 762 | this.check_after_move = function (moving){ |
| 763 | if (this._check_after_move){ |
| 764 | //if(this.log.is_debug()) this.log.debug("check after move"); |
| 765 | for (var i = 0; i < this._check_after_move.length; i++){ |
| 766 | var c = this._check_after_move[i]; |
| 767 | //if(this.log.is_debug()) this.log.debug("check after move1"); |
nothing calls this directly
no test coverage detected