aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-06-18 13:55:17 (GMT)
committerfluxgen <fluxgen>2003-06-18 13:55:17 (GMT)
commite3ab62fed1e63be3e7f6b81c316b15097638faf6 (patch)
tree563a2d45e6e33de08f2b899bbe775f9b2a5a755b /src
parent501168b557f4c21ca10dfdaad7776c125968363a (diff)
downloadfluxbox-e3ab62fed1e63be3e7f6b81c316b15097638faf6.zip
fluxbox-e3ab62fed1e63be3e7f6b81c316b15097638faf6.tar.bz2
added strut support
Diffstat (limited to 'src')
-rw-r--r--src/Slit.cc61
-rw-r--r--src/Slit.hh6
-rw-r--r--src/Toolbar.cc53
-rw-r--r--src/Toolbar.hh8
-rw-r--r--src/Window.cc21
-rw-r--r--src/Window.hh10
6 files changed, 147 insertions, 12 deletions
diff --git a/src/Slit.cc b/src/Slit.cc
index 83d2928..d6629b5 100644
--- a/src/Slit.cc
+++ b/src/Slit.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Slit.cc,v 1.60 2003/06/13 05:03:43 fluxgen Exp $ 25// $Id: Slit.cc,v 1.61 2003/06/18 13:49:43 fluxgen Exp $
26 26
27#include "Slit.hh" 27#include "Slit.hh"
28 28
@@ -291,7 +291,8 @@ Slit::Slit(BScreen &scr, FbTk::XLayer &layer, const char *filename)
291 "_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR", False)), //KDE v2.x 291 "_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR", False)), //KDE v2.x
292 292
293 m_layeritem(0), 293 m_layeritem(0),
294 m_slit_theme(new SlitTheme(*this)) { 294 m_slit_theme(new SlitTheme(*this)),
295 m_strut(0) {
295 296
296 // default placement and direction 297 // default placement and direction
297 m_direction = screen().getSlitDirection(); 298 m_direction = screen().getSlitDirection();
@@ -339,10 +340,65 @@ Slit::Slit(BScreen &scr, FbTk::XLayer &layer, const char *filename)
339 340
340 341
341Slit::~Slit() { 342Slit::~Slit() {
343 clearStrut();
342 if (frame.pixmap != 0) 344 if (frame.pixmap != 0)
343 screen().imageControl().removeImage(frame.pixmap); 345 screen().imageControl().removeImage(frame.pixmap);
344} 346}
345 347
348void Slit::clearStrut() {
349 if (m_strut != 0) {
350 screen().clearStrut(m_strut);
351 m_strut = 0;
352 }
353}
354
355void Slit::updateStrut() {
356 clearStrut();
357 // no need for area if we're autohiding
358 if (doAutoHide())
359 return;
360
361 int left = 0, right = 0, top = 0, bottom = 0;
362 switch (placement()) {
363 case TOPLEFT:
364 top = height();
365 left = width();
366 break;
367 case TOPCENTER:
368 top = height();
369 break;
370 case TOPRIGHT:
371 right = width();
372 top = height();
373 break;
374 case BOTTOMLEFT:
375 bottom = height();
376 left = width();
377 break;
378 case BOTTOMCENTER:
379 // would be strange to have it request size on vertical direction
380 // each time we add a client
381 if (direction() == HORIZONTAL)
382 bottom = height();
383 break;
384 case BOTTOMRIGHT:
385 if (direction() == HORIZONTAL)
386 bottom = height();
387 else
388 right = width();
389 break;
390 case CENTERLEFT:
391 if (direction() == VERTICAL)
392 left = width();
393 break;
394 case CENTERRIGHT:
395 if (direction() == VERTICAL)
396 right = width();
397 break;
398 }
399 m_strut = screen().requestStrut(left, right, top, bottom);
400 screen().updateAvailableWorkspaceArea();
401}
346 402
347void Slit::addClient(Window w) { 403void Slit::addClient(Window w) {
348#ifdef DEBUG 404#ifdef DEBUG
@@ -777,6 +833,7 @@ void Slit::reconfigure() {
777 833
778 m_slitmenu.reconfigure(); 834 m_slitmenu.reconfigure();
779 updateClientmenu(); 835 updateClientmenu();
836 updateStrut();
780} 837}
781 838
782 839
diff --git a/src/Slit.hh b/src/Slit.hh
index 10b141a..7626665 100644
--- a/src/Slit.hh
+++ b/src/Slit.hh
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25/// $Id: Slit.hh,v 1.30 2003/05/17 11:00:50 fluxgen Exp $ 25/// $Id: Slit.hh,v 1.31 2003/06/18 13:49:43 fluxgen Exp $
26 26
27#ifndef SLIT_HH 27#ifndef SLIT_HH
28#define SLIT_HH 28#define SLIT_HH
@@ -44,6 +44,7 @@ class SlitTheme;
44class SlitClient; 44class SlitClient;
45class BScreen; 45class BScreen;
46class FbMenu; 46class FbMenu;
47class Strut;
47 48
48/// Handles dock apps 49/// Handles dock apps
49class Slit : public FbTk::TimeoutHandler, public FbTk::EventHandler { 50class Slit : public FbTk::TimeoutHandler, public FbTk::EventHandler {
@@ -117,6 +118,8 @@ private:
117 void removeClient(SlitClient *client, bool remap, bool destroy); 118 void removeClient(SlitClient *client, bool remap, bool destroy);
118 void loadClientList(const char *filename); 119 void loadClientList(const char *filename);
119 void updateClientmenu(); 120 void updateClientmenu();
121 void clearStrut();
122 void updateStrut();
120 123
121 bool m_hidden, m_do_auto_hide; 124 bool m_hidden, m_do_auto_hide;
122 Direction m_direction; 125 Direction m_direction;
@@ -147,6 +150,7 @@ private:
147 std::auto_ptr<SlitTheme> m_slit_theme; 150 std::auto_ptr<SlitTheme> m_slit_theme;
148 std::auto_ptr<FbTk::Transparent> m_transp; 151 std::auto_ptr<FbTk::Transparent> m_transp;
149 static unsigned int s_eventmask; 152 static unsigned int s_eventmask;
153 Strut *m_strut;
150}; 154};
151 155
152 156
diff --git a/src/Toolbar.cc b/src/Toolbar.cc
index 544a1e3..c87e1ca 100644
--- a/src/Toolbar.cc
+++ b/src/Toolbar.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Toolbar.cc,v 1.90 2003/06/13 05:04:14 fluxgen Exp $ 25// $Id: Toolbar.cc,v 1.91 2003/06/18 13:50:40 fluxgen Exp $
26 26
27#include "Toolbar.hh" 27#include "Toolbar.hh"
28 28
@@ -43,6 +43,7 @@
43#include "BoolMenuItem.hh" 43#include "BoolMenuItem.hh"
44#include "FbWinFrameTheme.hh" 44#include "FbWinFrameTheme.hh"
45#include "Xinerama.hh" 45#include "Xinerama.hh"
46#include "Strut.hh"
46 47
47// use GNU extensions 48// use GNU extensions
48#ifndef _GNU_SOURCE 49#ifndef _GNU_SOURCE
@@ -279,7 +280,8 @@ Toolbar::Toolbar(BScreen &scrn, FbTk::XLayer &layer, FbTk::Menu &menu, size_t wi
279 m_theme(scrn.screenNumber()), 280 m_theme(scrn.screenNumber()),
280 m_place(scrn.toolbarPlacement()), 281 m_place(scrn.toolbarPlacement()),
281 m_themelistener(*this), 282 m_themelistener(*this),
282 m_layeritem(frame.window, layer) { 283 m_layeritem(frame.window, layer),
284 m_strut(0) {
283 285
284 // we need to get notified when the theme is reloaded 286 // we need to get notified when the theme is reloaded
285 m_theme.addListener(m_themelistener); 287 m_theme.addListener(m_themelistener);
@@ -339,6 +341,7 @@ Toolbar::Toolbar(BScreen &scrn, FbTk::XLayer &layer, FbTk::Menu &menu, size_t wi
339 341
340 342
341Toolbar::~Toolbar() { 343Toolbar::~Toolbar() {
344 clearStrut();
342 FbTk::ImageControl &image_ctrl = screen().imageControl(); 345 FbTk::ImageControl &image_ctrl = screen().imageControl();
343 if (frame.base) image_ctrl.removeImage(frame.base); 346 if (frame.base) image_ctrl.removeImage(frame.base);
344 if (frame.label) image_ctrl.removeImage(frame.label); 347 if (frame.label) image_ctrl.removeImage(frame.label);
@@ -349,6 +352,48 @@ Toolbar::~Toolbar() {
349 352
350} 353}
351 354
355void Toolbar::clearStrut() {
356 if (m_strut) {
357 screen().clearStrut(m_strut);
358 m_strut = 0;
359 }
360}
361
362void Toolbar::updateStrut() {
363 clearStrut();
364 // we should request space if we're in autohide mode or
365 // if the user dont want to request space for toolbar.
366 if (doAutoHide())
367 return;
368
369 // request area on screen
370 int top = 0, bottom = 0, left = 0, right = 0;
371 switch (m_place) {
372 case TOPLEFT:
373 case TOPCENTER:
374 case TOPRIGHT:
375 top = height();
376 break;
377 case BOTTOMLEFT:
378 case BOTTOMCENTER:
379 case BOTTOMRIGHT:
380 bottom = height();
381 break;
382 case RIGHTTOP:
383 case RIGHTCENTER:
384 case RIGHTBOTTOM:
385 right = width();
386 break;
387 case LEFTTOP:
388 case LEFTCENTER:
389 case LEFTBOTTOM:
390 left = width();
391 break;
392 };
393 m_strut = screen().requestStrut(left, right, top, bottom);
394 screen().updateAvailableWorkspaceArea();
395}
396
352bool Toolbar::isVertical() const { 397bool Toolbar::isVertical() const {
353 return (m_place == RIGHTCENTER || 398 return (m_place == RIGHTCENTER ||
354 m_place == RIGHTTOP || 399 m_place == RIGHTTOP ||
@@ -702,7 +747,9 @@ void Toolbar::reconfigure() {
702 checkClock(true); 747 checkClock(true);
703 748
704 m_toolbarmenu.reconfigure(); 749 m_toolbarmenu.reconfigure();
705 750 // we're done with all resizing and stuff now we can request a new
751 // area to be reserv on screen
752 updateStrut();
706} 753}
707 754
708 755
diff --git a/src/Toolbar.hh b/src/Toolbar.hh
index a1c5c50..f8d3fe4 100644
--- a/src/Toolbar.hh
+++ b/src/Toolbar.hh
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Toolbar.hh,v 1.32 2003/06/11 14:50:57 fluxgen Exp $ 25// $Id: Toolbar.hh,v 1.33 2003/06/18 13:50:40 fluxgen Exp $
26 26
27#ifndef TOOLBAR_HH 27#ifndef TOOLBAR_HH
28#define TOOLBAR_HH 28#define TOOLBAR_HH
@@ -42,6 +42,8 @@
42#include <memory> 42#include <memory>
43 43
44class BScreen; 44class BScreen;
45class Strut;
46
45namespace FbTk { 47namespace FbTk {
46class ImageControl; 48class ImageControl;
47}; 49};
@@ -133,6 +135,8 @@ public:
133 135
134 136
135private: 137private:
138 void clearStrut();
139 void updateStrut();
136 140
137 bool editing; ///< edit workspace label mode 141 bool editing; ///< edit workspace label mode
138 bool hidden; ///< hidden state 142 bool hidden; ///< hidden state
@@ -189,6 +193,8 @@ private:
189 ThemeListener m_themelistener; 193 ThemeListener m_themelistener;
190 194
191 FbTk::XLayerItem m_layeritem; 195 FbTk::XLayerItem m_layeritem;
196
197 Strut *m_strut; ///< created and destroyed by BScreen
192}; 198};
193 199
194 200
diff --git a/src/Window.cc b/src/Window.cc
index 0e4e8b0..9eabc0c 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Window.cc,v 1.192 2003/06/15 18:35:32 fluxgen Exp $ 25// $Id: Window.cc,v 1.193 2003/06/18 13:55:17 fluxgen Exp $
26 26
27#include "Window.hh" 27#include "Window.hh"
28 28
@@ -246,6 +246,7 @@ FluxboxWindow::FluxboxWindow(WinClient &client, BScreen &scr, FbWinFrameTheme &t
246 m_old_decoration(DECOR_NORMAL), 246 m_old_decoration(DECOR_NORMAL),
247 m_client(&client), 247 m_client(&client),
248 m_frame(new FbWinFrame(tm, scr.imageControl(), scr.screenNumber(), 0, 0, 100, 100)), 248 m_frame(new FbWinFrame(tm, scr.imageControl(), scr.screenNumber(), 0, 0, 100, 100)),
249 m_strut(0),
249 m_layeritem(m_frame->window(), layer), 250 m_layeritem(m_frame->window(), layer),
250 m_layernum(layer.getLayerNum()), 251 m_layernum(layer.getLayerNum()),
251 m_parent(scr.rootWindow()) { 252 m_parent(scr.rootWindow()) {
@@ -279,6 +280,7 @@ FluxboxWindow::FluxboxWindow(Window w, BScreen &scr, FbWinFrameTheme &tm,
279 m_old_decoration(DECOR_NORMAL), 280 m_old_decoration(DECOR_NORMAL),
280 m_client(new WinClient(w, *this)), 281 m_client(new WinClient(w, *this)),
281 m_frame(new FbWinFrame(tm, scr.imageControl(), scr.screenNumber(), 0, 0, 100, 100)), 282 m_frame(new FbWinFrame(tm, scr.imageControl(), scr.screenNumber(), 0, 0, 100, 100)),
283 m_strut(0),
282 m_layeritem(m_frame->window(), layer), 284 m_layeritem(m_frame->window(), layer),
283 m_layernum(layer.getLayerNum()), 285 m_layernum(layer.getLayerNum()),
284 m_parent(scr.rootWindow()) { 286 m_parent(scr.rootWindow()) {
@@ -296,6 +298,9 @@ FluxboxWindow::~FluxboxWindow() {
296 cerr<<__FILE__<<"("<<__LINE__<<"): curr client = "<<m_client<<endl; 298 cerr<<__FILE__<<"("<<__LINE__<<"): curr client = "<<m_client<<endl;
297 cerr<<__FILE__<<"("<<__LINE__<<"): m_labelbuttons.size = "<<m_labelbuttons.size()<<endl; 299 cerr<<__FILE__<<"("<<__LINE__<<"): m_labelbuttons.size = "<<m_labelbuttons.size()<<endl;
298#endif // DEBUG 300#endif // DEBUG
301
302 clearStrut();
303
299 if (moving || resizing || m_attaching_tab) { 304 if (moving || resizing || m_attaching_tab) {
300 screen().hideGeometry(); 305 screen().hideGeometry();
301 XUngrabPointer(display, CurrentTime); 306 XUngrabPointer(display, CurrentTime);
@@ -1989,8 +1994,6 @@ void FluxboxWindow::handleEvent(XEvent &event) {
1989 } 1994 }
1990 break; 1995 break;
1991 1996
1992
1993
1994 default: 1997 default:
1995#ifdef SHAPE 1998#ifdef SHAPE
1996 if (Fluxbox::instance()->haveShape() && 1999 if (Fluxbox::instance()->haveShape() &&
@@ -2714,6 +2717,18 @@ void FluxboxWindow::toggleDecoration() {
2714 } 2717 }
2715} 2718}
2716 2719
2720void FluxboxWindow::setStrut(Strut *strut) {
2721 clearStrut();
2722 m_strut = strut;
2723}
2724
2725void FluxboxWindow::clearStrut() {
2726 if (m_strut != 0) {
2727 screen().clearStrut(m_strut);
2728 m_strut = 0;
2729 }
2730}
2731
2717unsigned int FluxboxWindow::decorationMask() const { 2732unsigned int FluxboxWindow::decorationMask() const {
2718 unsigned int ret = 0; 2733 unsigned int ret = 0;
2719 if (decorations.titlebar) 2734 if (decorations.titlebar)
diff --git a/src/Window.hh b/src/Window.hh
index b5b86fa..59a9084 100644
--- a/src/Window.hh
+++ b/src/Window.hh
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Window.hh,v 1.78 2003/06/15 18:34:48 fluxgen Exp $ 25// $Id: Window.hh,v 1.79 2003/06/18 13:55:16 fluxgen Exp $
26 26
27#ifndef WINDOW_HH 27#ifndef WINDOW_HH
28#define WINDOW_HH 28#define WINDOW_HH
@@ -44,9 +44,10 @@
44class WinClient; 44class WinClient;
45class FbWinFrameTheme; 45class FbWinFrameTheme;
46class BScreen; 46class BScreen;
47class Strut;
48
47class TextButton; 49class TextButton;
48class FbWinFrame; 50class FbWinFrame;
49
50namespace FbTk { 51namespace FbTk {
51class MenuTheme; 52class MenuTheme;
52class ImageControl; 53class ImageControl;
@@ -242,6 +243,9 @@ public:
242 DECORM_LAST = (1<<11) // useful for getting "All" 243 DECORM_LAST = (1<<11) // useful for getting "All"
243 }; 244 };
244 245
246 void setStrut(Strut *strut);
247 void clearStrut();
248
245 unsigned int decorationMask() const; 249 unsigned int decorationMask() const;
246 void setDecorationMask(unsigned int mask); 250 void setDecorationMask(unsigned int mask);
247 251
@@ -441,6 +445,8 @@ private:
441 m_last_button_y; ///< last known y position of the mouse button 445 m_last_button_y; ///< last known y position of the mouse button
442 std::auto_ptr<FbWinFrame> m_frame; 446 std::auto_ptr<FbWinFrame> m_frame;
443 447
448 Strut *m_strut;
449
444 FbTk::XLayerItem m_layeritem; 450 FbTk::XLayerItem m_layeritem;
445 int m_layernum; 451 int m_layernum;
446 452