aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarkt <markt>2007-07-03 21:09:05 (GMT)
committermarkt <markt>2007-07-03 21:09:05 (GMT)
commit8f6434efa67b2f11548c9862aaa0d29488645500 (patch)
treead8e627d4d2b3aa4e46e4c60bd2034d93130ff45
parentdf5974b9235a345ae68fa8ff96256ae68ab2518b (diff)
downloadfluxbox-8f6434efa67b2f11548c9862aaa0d29488645500.zip
fluxbox-8f6434efa67b2f11548c9862aaa0d29488645500.tar.bz2
stop gvim from repeatedly resizing tabbed windows
-rw-r--r--src/FbTk/FbPixmap.cc15
-rw-r--r--src/FbTk/FbWindow.cc8
-rw-r--r--src/WinClient.cc25
-rw-r--r--src/WinClient.hh2
-rw-r--r--src/Window.cc9
-rw-r--r--util/fluxbox-remote.cc20
6 files changed, 61 insertions, 18 deletions
diff --git a/src/FbTk/FbPixmap.cc b/src/FbTk/FbPixmap.cc
index 9143232..0289ddd 100644
--- a/src/FbTk/FbPixmap.cc
+++ b/src/FbTk/FbPixmap.cc
@@ -114,13 +114,14 @@ FbPixmap &FbPixmap::operator = (Pixmap pm) {
114 Window root; 114 Window root;
115 int x, y; 115 int x, y;
116 unsigned int border_width, bpp; 116 unsigned int border_width, bpp;
117 XGetGeometry(display(), 117 if (!XGetGeometry(display(),
118 pm, 118 pm,
119 &root, 119 &root,
120 &x, &y, 120 &x, &y,
121 &m_width, &m_height, 121 &m_width, &m_height,
122 &border_width, 122 &border_width,
123 &bpp); 123 &bpp))
124 return *this;
124 125
125 m_depth = bpp; 126 m_depth = bpp;
126 127
diff --git a/src/FbTk/FbWindow.cc b/src/FbTk/FbWindow.cc
index 3dce5b8..2c2bb24 100644
--- a/src/FbTk/FbWindow.cc
+++ b/src/FbTk/FbWindow.cc
@@ -582,10 +582,10 @@ void FbWindow::updateGeometry() {
582 582
583 Window root; 583 Window root;
584 unsigned int border_width, depth; 584 unsigned int border_width, depth;
585 XGetGeometry(display(), m_window, &root, &m_x, &m_y, 585 if (XGetGeometry(display(), m_window, &root, &m_x, &m_y,
586 (unsigned int *)&m_width, (unsigned int *)&m_height, 586 (unsigned int *)&m_width, (unsigned int *)&m_height,
587 &border_width, &depth); 587 &border_width, &depth))
588 m_depth = depth; 588 m_depth = depth;
589} 589}
590 590
591void FbWindow::create(Window parent, int x, int y, 591void FbWindow::create(Window parent, int x, int y,
diff --git a/src/WinClient.cc b/src/WinClient.cc
index ddf0599..a9d5865 100644
--- a/src/WinClient.cc
+++ b/src/WinClient.cc
@@ -905,6 +905,31 @@ void WinClient::applySizeHints(int &width, int &height,
905 *display_height = j; 905 *display_height = j;
906} 906}
907 907
908// check if the given width and height satisfy the size hints
909bool WinClient::checkSizeHints(unsigned int width, unsigned int height) {
910 if (width < min_width || height < min_height)
911 return false;
912
913 if (width > max_width || height > max_height)
914 return false;
915
916 if ((width - base_width) % width_inc != 0)
917 return false;
918
919 if ((height - base_height) % height_inc != 0)
920 return false;
921
922 double ratio = (double)width / (double)height;
923
924 if (min_aspect_y > 0 && (double)min_aspect_x / (double)min_aspect_y > ratio)
925 return false;
926
927 if (max_aspect_y > 0 && (double)max_aspect_x / (double)max_aspect_y < ratio)
928 return false;
929
930 return true;
931}
932
908void WinClient::removeTransientFromWaitingList() { 933void WinClient::removeTransientFromWaitingList() {
909 934
910 // holds the windows that dont have empty 935 // holds the windows that dont have empty
diff --git a/src/WinClient.hh b/src/WinClient.hh
index d3555d1..9c29e78 100644
--- a/src/WinClient.hh
+++ b/src/WinClient.hh
@@ -93,7 +93,7 @@ public:
93 */ 93 */
94 void applySizeHints(int &width, int &height, int *display_width = 0, 94 void applySizeHints(int &width, int &height, int *display_width = 0,
95 int *display_height = 0, bool maximizing = false); 95 int *display_height = 0, bool maximizing = false);
96 96 bool checkSizeHints(unsigned int width, unsigned int height);
97 97
98 void setGroupLeftWindow(Window win); 98 void setGroupLeftWindow(Window win);
99 99
diff --git a/src/Window.cc b/src/Window.cc
index e9d57c2..632c1e7 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -2570,6 +2570,15 @@ void FluxboxWindow::configureRequestEvent(XConfigureRequestEvent &cr) {
2570 int cx = frame().x(), cy = frame().y(), ignore = 0; 2570 int cx = frame().x(), cy = frame().y(), ignore = 0;
2571 unsigned int cw = frame().width(), ch = frame().height(); 2571 unsigned int cw = frame().width(), ch = frame().height();
2572 2572
2573 // if this is not m_client and m_client has resize_inc, make sure the new
2574 // size would be ok with m_client
2575 if (client != m_client && cr.value_mask & CWWidth &&
2576 cr.value_mask & CWHeight &&
2577 !m_client->checkSizeHints(cr.width, cr.height)) {
2578 sendConfigureNotify();
2579 return;
2580 }
2581
2573 if (cr.value_mask & CWBorderWidth) 2582 if (cr.value_mask & CWBorderWidth)
2574 client->old_bw = cr.border_width; 2583 client->old_bw = cr.border_width;
2575 2584
diff --git a/util/fluxbox-remote.cc b/util/fluxbox-remote.cc
index eb7a413..67c2193 100644
--- a/util/fluxbox-remote.cc
+++ b/util/fluxbox-remote.cc
@@ -24,15 +24,21 @@
24#include <X11/Xlib.h> 24#include <X11/Xlib.h>
25#include <X11/Xatom.h> 25#include <X11/Xatom.h>
26#include <string.h> 26#include <string.h>
27#include <stdlib.h>
28#include <stdio.h>
27 29
28int main(int argc, char **argv) { 30int main(int argc, char **argv) {
29 31
30 if (argc <= 1) 32 if (argc <= 1) {
31 return 1; 33 printf("fluxbox-remote <fluxbox-command>\n");
34 return EXIT_SUCCESS;
35 }
32 36
33 Display *disp = XOpenDisplay(NULL); 37 Display *disp = XOpenDisplay(NULL);
34 if (!disp) 38 if (!disp) {
35 return 1; 39 perror("error, can't open display.");
40 return EXIT_FAILURE;
41 }
36 42
37 Atom fbcmd_atom = XInternAtom(disp, "_FLUXBOX_COMMAND", False); 43 Atom fbcmd_atom = XInternAtom(disp, "_FLUXBOX_COMMAND", False);
38 Window root = DefaultRootWindow(disp); 44 Window root = DefaultRootWindow(disp);
@@ -44,6 +50,8 @@ int main(int argc, char **argv) {
44 XCloseDisplay(disp); 50 XCloseDisplay(disp);
45 51
46 if (ret == Success) 52 if (ret == Success)
47 return 0; 53 return EXIT_SUCCESS;
48 return 1; 54
55 return EXIT_FAILURE;
49} 56}
57