mirror of
https://github.com/dylanaraps/sowm.git
synced 2025-05-19 09:30:24 -07:00
Simplify multimonitor_center_fs()
This commit is contained in:
parent
4dd50e6f4f
commit
c6ff8d06a0
@ -10,7 +10,7 @@ index 8573837..72e9542 100644
|
|||||||
PREFIX?= /usr
|
PREFIX?= /usr
|
||||||
BINDIR?= $(PREFIX)/bin
|
BINDIR?= $(PREFIX)/bin
|
||||||
diff --git a/sowm.c b/sowm.c
|
diff --git a/sowm.c b/sowm.c
|
||||||
index 0cc1293..665b0f8 100644
|
index 0cc1293..fa911b0 100644
|
||||||
--- a/sowm.c
|
--- a/sowm.c
|
||||||
+++ b/sowm.c
|
+++ b/sowm.c
|
||||||
@@ -4,6 +4,7 @@
|
@@ -4,6 +4,7 @@
|
||||||
@ -38,12 +38,13 @@ index 0cc1293..665b0f8 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
void key_press(XEvent *e) {
|
void key_press(XEvent *e) {
|
||||||
@@ -172,12 +174,36 @@ void win_kill() {
|
@@ -172,12 +174,35 @@ void win_kill() {
|
||||||
if (cur) XKillClient(d, cur->w);
|
if (cur) XKillClient(d, cur->w);
|
||||||
}
|
}
|
||||||
|
|
||||||
+int multimonitor_center_fs (int fs) {
|
+int multimonitor_center_fs (int fs) {
|
||||||
+ if (XineramaIsActive(d)) {
|
+ if (!XineramaIsActive(d))
|
||||||
|
+ return 1;
|
||||||
+ XineramaScreenInfo *screen_info = XineramaQueryScreens(d, &monitors);
|
+ XineramaScreenInfo *screen_info = XineramaQueryScreens(d, &monitors);
|
||||||
+ for (int i = 0; i < monitors; i++) {
|
+ for (int i = 0; i < monitors; i++) {
|
||||||
+ if ((cur->wx >= screen_info[i].x_org && cur->wx < screen_info[i].x_org + screen_info[i].width)
|
+ if ((cur->wx >= screen_info[i].x_org && cur->wx < screen_info[i].x_org + screen_info[i].width)
|
||||||
@ -57,11 +58,9 @@ index 0cc1293..665b0f8 100644
|
|||||||
+ screen_info[i].x_org + ((screen_info[i].width - ww) / 2),
|
+ screen_info[i].x_org + ((screen_info[i].width - ww) / 2),
|
||||||
+ screen_info[i].y_org + ((screen_info[i].height - wh) / 2));
|
+ screen_info[i].y_org + ((screen_info[i].height - wh) / 2));
|
||||||
+ }
|
+ }
|
||||||
|
+ }
|
||||||
+ return 0;
|
+ return 0;
|
||||||
+}
|
+}
|
||||||
+ }
|
|
||||||
+ return 1;
|
|
||||||
+}
|
|
||||||
+
|
+
|
||||||
void win_center() {
|
void win_center() {
|
||||||
if (!cur) return;
|
if (!cur) return;
|
||||||
@ -76,7 +75,7 @@ index 0cc1293..665b0f8 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
void win_fs() {
|
void win_fs() {
|
||||||
@@ -185,8 +211,8 @@ void win_fs() {
|
@@ -185,8 +210,8 @@ void win_fs() {
|
||||||
|
|
||||||
if ((cur->f = cur->f ? 0 : 1)) {
|
if ((cur->f = cur->f ? 0 : 1)) {
|
||||||
win_size(cur->w, &cur->wx, &cur->wy, &cur->ww, &cur->wh);
|
win_size(cur->w, &cur->wx, &cur->wy, &cur->ww, &cur->wh);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user