summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorQue Quotion2018-09-17 06:09:47 +0900
committerQue Quotion2018-09-17 06:09:47 +0900
commit3de9564dee82434fd6bc59e724ecfd03942c0206 (patch)
tree460a0b1e0b6ef6814ffcb8012b4ce4bf5e2d2ad2
parent8390531c3213edfdc352b44fca0bc09b61d44063 (diff)
downloadaur-3de9564dee82434fd6bc59e724ecfd03942c0206.tar.gz
Dodge maximized windows: two new autohide modes.
Dodge avoids the currently focused and maximized window, but appears with struts on mouseover (pushes windows down). Dodge-Float avoids the currently focused and maximized window, but appears without struts on mouseover (hovers over windows). Dodge maximize code imported from Keith Bailey's fork: https://code.launchpad.net/~kbailey4444/wingpanel/dodge-maximize Co-authored-by: Keith Bailey <kbailey4444@gmail.com>
-rw-r--r--.SRCINFO6
-rw-r--r--PKGBUILD10
-rw-r--r--autohide.patch219
-rw-r--r--minus-backgroundmanager.patch8
4 files changed, 179 insertions, 64 deletions
diff --git a/.SRCINFO b/.SRCINFO
index f3cd2ef9621..1fa733397cd 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,6 +1,6 @@
pkgbase = wingpanel-standalone-git
pkgdesc = Stylish top panel that holds indicators and spawns an application launcher (without Gala dependencies)
- pkgver = r361.f8341c8
+ pkgver = r367.6284121
pkgrel = 1
url = https://github.com/elementary/wingpanel
arch = i686
@@ -48,11 +48,11 @@ pkgbase = wingpanel-standalone-git
source = autohide.patch
source = reverse-105c1d0.patch
sha256sums = SKIP
- sha256sums = dc9870a9e58ba1c438c4b631c95ce7e5a5f76b9e53355959e67ce1ba0263b651
+ sha256sums = 67ffdac17cd4f46fb866eb8d33dd06db918bca16ae8ed4b2a2a00c3112f87a2b
sha256sums = 7f972d79b4d72f7b274a96e1a5150cba0e3869ad85215ae01ad2bc19802cdbb9
sha256sums = 21e95aec3fbb920f3b8ef34b00bf4fc99f431e1837f84f020d5d00c4e3aaca0b
sha256sums = b1902c1d44ac546df63cd0224a7d2ef2cb6394ca556512c30c370d387db7bbab
- sha256sums = cd7a7bf3c3cec2812f0bb4a355588fe95530c6220e0c92abcae49713ab66f924
+ sha256sums = 244b035630316c1f1a091dde16936f411600fdc68bd0dab9735f335fce3eeccc
sha256sums = 53bfa2220d14065ca848c36217abe812685c7d6e0d42251423d0faa2a0ac5394
pkgname = wingpanel-standalone-git
diff --git a/PKGBUILD b/PKGBUILD
index 4fec7005a76..e17014e609c 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -2,7 +2,7 @@
# Contributor: Maxime Gauduin <alucryd@archlinux.org>
pkgname=wingpanel-standalone-git
-pkgver=r361.f8341c8
+pkgver=r367.6284121
pkgrel=1
pkgdesc='Stylish top panel that holds indicators and spawns an application launcher (without Gala dependencies)'
arch=('i686' 'x86_64')
@@ -30,11 +30,11 @@ source=('git+https://github.com/elementary/wingpanel.git'
'autohide.patch'
'reverse-105c1d0.patch')
sha256sums=('SKIP'
- 'dc9870a9e58ba1c438c4b631c95ce7e5a5f76b9e53355959e67ce1ba0263b651'
+ '67ffdac17cd4f46fb866eb8d33dd06db918bca16ae8ed4b2a2a00c3112f87a2b'
'7f972d79b4d72f7b274a96e1a5150cba0e3869ad85215ae01ad2bc19802cdbb9'
'21e95aec3fbb920f3b8ef34b00bf4fc99f431e1837f84f020d5d00c4e3aaca0b'
'b1902c1d44ac546df63cd0224a7d2ef2cb6394ca556512c30c370d387db7bbab'
- 'cd7a7bf3c3cec2812f0bb4a355588fe95530c6220e0c92abcae49713ab66f924'
+ '244b035630316c1f1a091dde16936f411600fdc68bd0dab9735f335fce3eeccc'
'53bfa2220d14065ca848c36217abe812685c7d6e0d42251423d0faa2a0ac5394')
pkgver() {
@@ -47,12 +47,12 @@ prepare() {
cd wingpanel
#Reverse 105c1d0
- msg2 "Autohide"
+ msg2 "Reverse commit 105c1d0"
patch -Np1 < ../reverse-105c1d0.patch
#Autohide
msg2 "Autohide"
- patch -Np2 < ../autohide.patch
+ patch -Np2 < ../autohide-dodge.patch
#patch -Np2 < ../autohide-testing.patch
#Standalone patches
diff --git a/autohide.patch b/autohide.patch
index 74d10a26f37..d708dea759d 100644
--- a/autohide.patch
+++ b/autohide.patch
@@ -2,7 +2,7 @@ diff --git a/wingpanel/schemas/io.elementary.desktop.wingpanel.gschema.xml b/win
index c81abd5..890e277 100644
--- a/wingpanel/schemas/io.elementary.desktop.wingpanel.gschema.xml
+++ b/wingpanel-qq/schemas/io.elementary.desktop.wingpanel.gschema.xml
-@@ -6,5 +6,21 @@
+@@ -6,5 +6,23 @@
<summary>Sets if the panel uses transparency.</summary>
<description>Disable this to provide higher contrasts and make indicators better readable.</description>
</key>
@@ -10,6 +10,8 @@ index c81abd5..890e277 100644
+ <choices>
+ <choice value='Autohide'/>
+ <choice value='Float'/>
++ <choice value='Dodge'/>
++ <choice value='Dodge-Float'/>
+ <choice value='Disabled'/>
+ </choices>
+ <default>'Disabled'</default>
@@ -38,21 +40,23 @@ index c48b5ea..81ec2f2 100644
private int monitor_number;
private int monitor_width;
private int monitor_height;
-@@ -30,6 +33,10 @@ public class Wingpanel.PanelWindow : Gtk.Window {
+@@ -30,6 +33,11 @@ public class Wingpanel.PanelWindow : Gtk.Window {
private bool expanded = false;
private int panel_displacement;
private uint shrink_timeout = 0;
+ private bool hiding = false;
-+ private bool restrut = true;
++ private bool strut = true;
+ private string autohide = Services.PanelSettings.get_default ().autohide;
+ private int autohide_delay = Services.PanelSettings.get_default ().delay;
++ private Wnck.Screen wnck_screen = Wnck.Screen.get_default ();
public PanelWindow (Gtk.Application application) {
Object (
-@@ -52,6 +58,9 @@ public class Wingpanel.PanelWindow : Gtk.Window {
+@@ -52,6 +58,10 @@ public class Wingpanel.PanelWindow : Gtk.Window {
this.screen.size_changed.connect (update_panel_dimensions);
this.screen.monitors_changed.connect (update_panel_dimensions);
this.screen_changed.connect (update_visual);
++ wnck_screen.active_window_changed.connect (active_window_changed);
+ this.enter_notify_event.connect (show_panel);
+ this.motion_notify_event.connect (show_panel);
+ this.leave_notify_event.connect (hide_panel);
@@ -78,24 +82,24 @@ index c48b5ea..81ec2f2 100644
private bool animation_step () {
- if (panel_displacement <= panel_height * (-1)) {
- return false;
-+ if (hiding != true) {
-+ if (panel_displacement <= panel_height * (-1)) {
++ if (hiding) {
++ if (panel_displacement >= -1 || popover_manager.current_indicator != null) {
+ timeout = 0;
-+ if (restrut == true) {
++ if (strut == true) {
+ update_panel_dimensions ();
+ }
+ return false;
+ }
-+ panel_displacement--;
++ panel_displacement++;
+ } else {
-+ if (panel_displacement >= -1 || popover_manager.current_indicator != null) {
++ if (panel_displacement <= panel_height * (-1)) {
+ timeout = 0;
-+ if (restrut == true) {
++ if (strut == true) {
+ update_panel_dimensions ();
+ }
+ return false;
+ }
-+ panel_displacement++;
++ panel_displacement--;
}
- panel_displacement--;
@@ -105,69 +109,151 @@ index c48b5ea..81ec2f2 100644
return true;
}
-@@ -91,7 +115,65 @@ public class Wingpanel.PanelWindow : Gtk.Window {
+@@ -91,7 +115,147 @@ public class Wingpanel.PanelWindow : Gtk.Window {
Services.BackgroundManager.initialize (this.monitor_number, panel_height);
- Timeout.add (300 / panel_height, animation_step);
-+ if (autohide == "Disabled" || autohide == "Dodge") {
-+ hiding = false;
-+ restrut = true;
-+ timeout = Timeout.add (300 / panel_height, animation_step);
++ update_autohide_mode ();
++ }
++
++ private void active_window_changed (Wnck.Window? prev_active_window) {
++ unowned Wnck.Window? active_window = wnck_screen.get_active_window();
++ if (autohide == "Dodge" || autohide == "Dodge-Float")
++ update_visibility_active_change (active_window);
++
++ if (prev_active_window != null)
++ prev_active_window.state_changed.disconnect (active_window_state_changed);
++ if (active_window != null)
++ active_window.state_changed.connect (active_window_state_changed);
++ }
++
++ private void active_window_state_changed (Wnck.Window? window,
++ Wnck.WindowState changed_mask, Wnck.WindowState new_state) {
++ if (autohide == "Dodge" || autohide == "Dodge-Float")
++ update_visibility_active_change (window);
++ }
++
++ private void update_visibility_active_change (Wnck.Window? active_window) {
++ if (should_hide_active_change (active_window)) {
++ hide_panel ();
+ } else {
-+ panel_displacement--;
-+ animate_panel ();
++ show_panel ();
+ }
+ }
+
++ private bool should_hide_active_change (Wnck.Window? active_window) {
++ unowned Wnck.Workspace active_workspace = wnck_screen.get_active_workspace ();
++
++ return ((active_window != null) && !active_window.is_minimized () && right_type (active_window)
++ && active_window.is_visible_on_workspace (active_workspace)
++ && (active_window.get_window_type () == Wnck.WindowType.DIALOG) ?
++ would_intersect_shown_panel (active_window) :
++ (in_panel_x_range (active_window) && is_maximized_at_all (active_window)));
++ }
++
++ private bool would_intersect_shown_panel (Wnck.Window? window) {
++ Gdk.Rectangle shown_panel_rect = Gdk.Rectangle ();
++ shown_panel_rect.x = monitor_x;
++ shown_panel_rect.y = monitor_y;
++ shown_panel_rect.width = monitor_width;
++ shown_panel_rect.height = panel_height;
++
++ int xp, yp, widthp, heightp;
++ window.get_geometry (out xp, out yp, out widthp, out heightp);
++
++ Gdk.Rectangle window_rect = Gdk.Rectangle ();
++ window_rect.x = xp;
++ window_rect.width = widthp;
++ if (strut && is_maximized_at_all (window)) {
++ window_rect.y = yp - panel_height;
++ window_rect.height = heightp + panel_height;
++ } else {
++ window_rect.y = yp;
++ window_rect.height = heightp;
++ }
++
++ return window_rect.intersect (shown_panel_rect, null);
++ }
++
++ private bool in_panel_x_range (Wnck.Window? window) {
++ int xp, yp, widthp, heightp;
++ window.get_geometry (out xp, out yp, out widthp, out heightp);
++ if (xp > monitor_x)
++ return (monitor_x + monitor_width > xp);
++ else if (xp < monitor_x)
++ return (xp + widthp > monitor_x);
++ else
++ return (xp + widthp > 0 && monitor_x + monitor_width > 0);
++ }
++
++ private bool right_type (Wnck.Window? active_window) {
++ unowned Wnck.WindowType type = active_window.get_window_type ();
++ return (type == Wnck.WindowType.NORMAL || type == Wnck.WindowType.DIALOG
++ || type == Wnck.WindowType.TOOLBAR || type == Wnck.WindowType.UTILITY);
++ }
++
++ private bool is_maximized_at_all (Wnck.Window window) {
++ return (window.is_maximized_horizontally ()
++ || window.is_maximized_vertically ());
++ }
++
+ private bool hide_panel () {
-+ if (autohide != "Disabled") {
-+ hiding = true;
-+ if (timeout > 0) {
-+ Source.remove (timeout);
-+ }
-+ if (popover_manager.current_indicator == null) {
-+ Thread.usleep (autohide_delay * 1000);
-+ }
-+ if (autohide == "Autohide" || autohide == "Dodge") {
-+ restrut = true;
-+ timeout = Timeout.add (100 / panel_height, animation_step);
-+ } else if (autohide == "Float") {
-+ restrut = false;
-+ timeout = Timeout.add (100 / panel_height, animation_step);
++ if (timeout > 0) {
++ Source.remove (timeout);
++ }
++ if (autohide == "Dodge" || autohide == "Dodge-Float") {
++ if (!should_hide_active_change (wnck_screen.get_active_window())) {
++ return true;
+ }
+ }
++ if (popover_manager.current_indicator == null) {
++ Thread.usleep (autohide_delay * 1000);
++ }
++ strut = true;
++ hiding = true;
++ timeout = Timeout.add (100 / panel_height, animation_step);
+ return true;
+ }
+
+ private bool show_panel () {
-+ if (autohide != "Disabled") {
-+ hiding = false;
-+ if (timeout > 0) {
-+ Source.remove (timeout);
-+ }
-+ if (popover_manager.current_indicator == null) {
-+ Thread.usleep (autohide_delay * 1000);
-+ }
-+ if (autohide == "Autohide" || autohide == "Dodge") {
-+ restrut = true;
-+ timeout = Timeout.add (100 / panel_height, animation_step);
-+ } else if (autohide == "Float") {
-+ restrut = false;
-+ timeout = Timeout.add (100 / panel_height, animation_step);
-+ }
++ if (timeout > 0) {
++ Source.remove (timeout);
++ }
++ if (popover_manager.current_indicator == null) {
++ Thread.usleep (autohide_delay * 1000);
++ }
++ if (autohide == "Dodge-Float" || autohide == "Float") {
++ strut = false;
++ } else {
++ strut = true;
+ }
++ hiding = false;
++ timeout = Timeout.add (100 / panel_height, animation_step);
+ return true;
+ }
+
+ private void update_autohide_mode () {
-+ restrut = true;
-+ if (autohide == "Disabled" || autohide == "Dodge") {
-+ hiding = false;
-+ timeout = Timeout.add (100 / panel_height, animation_step);
-+ } else {
-+ hiding = true;
-+ timeout = Timeout.add (100 / panel_height, animation_step);
++ switch (autohide) {
++ case "Disabled":
++ this.enter_notify_event.disconnect (show_panel);
++ this.motion_notify_event.disconnect (show_panel);
++ this.leave_notify_event.disconnect (hide_panel);
++ show_panel ();
++ break;
++ case "Dodge":
++ case "Dodge-Float":
++ this.enter_notify_event.connect (show_panel);
++ this.motion_notify_event.connect (show_panel);
++ this.leave_notify_event.connect (hide_panel);
++ show_panel ();
++ break;
++ default:
++ this.enter_notify_event.connect (show_panel);
++ this.motion_notify_event.connect (show_panel);
++ this.leave_notify_event.connect (hide_panel);
++ hide_panel ();
++ break;
+ }
}
@@ -212,3 +298,28 @@ index 3bcd0a7..eeecbb8 100644
public PanelSettings () {
base ("io.elementary.desktop.wingpanel");
}
+--- src/wingpanel/CMakeLists.txt~ 2018-09-17 00:14:55.430071710 +0900
++++ src/wingpanel/CMakeLists.txt 2018-09-17 00:34:08.600075830 +0900
+@@ -76,6 +76,7 @@
+ gee-0.8
+ gmodule-2.0
+ gtk+-3.0
++ libwnck-3.0
+ )
+
+ set (LIB_PKG
+@@ -84,11 +85,14 @@
+ gee-0.8
+ gmodule-2.0
+ gtk+-3.0>=3.22
++ libwnck-3.0>=3.24
+ )
+ find_package(PkgConfig)
+
+ pkg_check_modules (LIB REQUIRED ${LIB_PKG})
+
++add_definitions (-DWNCK_I_KNOW_THIS_IS_UNSTABLE)
++
+ set (GLOBAL_VALAC_OPTIONS
+ --vapidir=${CMAKE_BINARY_DIR}/lib
+ --vapidir=vapi
diff --git a/minus-backgroundmanager.patch b/minus-backgroundmanager.patch
index 234c7bb1481..9a8250841f2 100644
--- a/minus-backgroundmanager.patch
+++ b/minus-backgroundmanager.patch
@@ -34,7 +34,7 @@
public Panel (Services.PopoverManager popover_manager) {
Object (popover_manager : popover_manager);
-@@ -64,39 +63,6 @@
+@@ -64,43 +63,6 @@
style_context = this.get_style_context ();
@@ -69,8 +69,12 @@
-
- popover_manager.close ();
-
+- var scale_factor = this.get_scale_factor ();
+- var x = (int)event.x_root * scale_factor;
+- var y = (int)event.y_root * scale_factor;
+-
- var background_manager = Services.BackgroundManager.get_default ();
-- return background_manager.begin_grab_focused_window ((int)event.x_root, (int)event.y_root, (int)event.button, time, state);
+- return background_manager.begin_grab_focused_window (x, y, (int)event.button, time, state);
}
public void cycle (bool forward) {