aboutsummaryrefslogtreecommitdiff
path: root/src/Screen.cc
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-05-15 23:30:07 (GMT)
committerfluxgen <fluxgen>2003-05-15 23:30:07 (GMT)
commit5bbc7662328c2f147ceec0b7e6c3367cfd0b7a5f (patch)
treed016e4843c109352b3df01fc98780052a13fb7c2 /src/Screen.cc
parent988392b1eb89deaddfddfcb37a15e8f55d58bb70 (diff)
downloadfluxbox-5bbc7662328c2f147ceec0b7e6c3367cfd0b7a5f.zip
fluxbox-5bbc7662328c2f147ceec0b7e6c3367cfd0b7a5f.tar.bz2
minor cleaning
Diffstat (limited to 'src/Screen.cc')
-rw-r--r--src/Screen.cc217
1 files changed, 107 insertions, 110 deletions
diff --git a/src/Screen.cc b/src/Screen.cc
index 49280e8..63a24fd 100644
--- a/src/Screen.cc
+++ b/src/Screen.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: Screen.cc,v 1.167 2003/05/15 12:00:44 fluxgen Exp $ 25// $Id: Screen.cc,v 1.168 2003/05/15 23:26:38 fluxgen Exp $
26 26
27 27
28#include "Screen.hh" 28#include "Screen.hh"
@@ -53,6 +53,7 @@
53#include "WinClient.hh" 53#include "WinClient.hh"
54#include "Subject.hh" 54#include "Subject.hh"
55#include "FbWinFrame.hh" 55#include "FbWinFrame.hh"
56#include "SlitResource.hh"
56 57
57//use GNU extensions 58//use GNU extensions
58#ifndef _GNU_SOURCE 59#ifndef _GNU_SOURCE
@@ -141,7 +142,7 @@ int anotherWMRunning(Display *display, XErrorEvent *) {
141FbTk::Menu *createMenuFromScreen(BScreen &screen) { 142FbTk::Menu *createMenuFromScreen(BScreen &screen) {
142 FbTk::Menu *menu = new FbMenu(*screen.menuTheme(), 143 FbTk::Menu *menu = new FbMenu(*screen.menuTheme(),
143 screen.screenNumber(), 144 screen.screenNumber(),
144 *screen.getImageControl(), 145 screen.imageControl(),
145 *screen.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())); 146 *screen.layerManager().getLayer(Fluxbox::instance()->getMenuLayer()));
146 return menu; 147 return menu;
147} 148}
@@ -197,28 +198,6 @@ setFromString(const char *strval) {
197 setDefaultValue(); 198 setDefaultValue();
198} 199}
199 200
200template<>
201void Resource<Slit::Placement>::
202setFromString(const char *strval) {
203 if (strcasecmp(strval, "TopLeft")==0)
204 m_value = Slit::TOPLEFT;
205 else if (strcasecmp(strval, "CenterLeft")==0)
206 m_value = Slit::CENTERLEFT;
207 else if (strcasecmp(strval, "BottomLeft")==0)
208 m_value = Slit::BOTTOMLEFT;
209 else if (strcasecmp(strval, "TopCenter")==0)
210 m_value = Slit::TOPCENTER;
211 else if (strcasecmp(strval, "BottomCenter")==0)
212 m_value = Slit::BOTTOMCENTER;
213 else if (strcasecmp(strval, "TopRight")==0)
214 m_value = Slit::TOPRIGHT;
215 else if (strcasecmp(strval, "CenterRight")==0)
216 m_value = Slit::CENTERRIGHT;
217 else if (strcasecmp(strval, "BottomRight")==0)
218 m_value = Slit::BOTTOMRIGHT;
219 else
220 setDefaultValue();
221}
222 201
223template<> 202template<>
224void Resource<ToolbarHandler::ToolbarMode>:: 203void Resource<ToolbarHandler::ToolbarMode>::
@@ -239,16 +218,6 @@ setFromString(const char *strval) {
239 setDefaultValue(); 218 setDefaultValue();
240} 219}
241 220
242template<>
243void Resource<Slit::Direction>::
244setFromString(const char *strval) {
245 if (strcasecmp(strval, "Vertical") == 0)
246 m_value = Slit::VERTICAL;
247 else if (strcasecmp(strval, "Horizontal") == 0)
248 m_value = Slit::HORIZONTAL;
249 else
250 setDefaultValue();
251}
252 221
253string Resource<Toolbar::Placement>:: 222string Resource<Toolbar::Placement>::
254getString() { 223getString() {
@@ -295,37 +264,6 @@ getString() {
295} 264}
296 265
297 266
298string Resource<Slit::Placement>::
299getString() {
300 switch (m_value) {
301 case Slit::TOPLEFT:
302 return string("TopLeft");
303 break;
304 case Slit::CENTERLEFT:
305 return string("CenterLeft");
306 break;
307 case Slit::BOTTOMLEFT:
308 return string("BottomLeft");
309 break;
310 case Slit::TOPCENTER:
311 return string("TopCenter");
312 break;
313 case Slit::BOTTOMCENTER:
314 return string("BottomCenter");
315 break;
316 case Slit::TOPRIGHT:
317 return string("TopRight");
318 break;
319 case Slit::CENTERRIGHT:
320 return string("CenterRight");
321 break;
322 case Slit::BOTTOMRIGHT:
323 return string("BottomRight");
324 break;
325 }
326 //default string
327 return string("BottomRight");
328}
329 267
330template<> 268template<>
331string Resource<ToolbarHandler::ToolbarMode>:: 269string Resource<ToolbarHandler::ToolbarMode>::
@@ -355,22 +293,6 @@ getString() {
355 return string("Icons"); 293 return string("Icons");
356} 294}
357 295
358template<>
359string Resource<Slit::Direction>::
360getString() {
361 switch (m_value) {
362 case Slit::VERTICAL:
363 return string("Vertical");
364 break;
365 case Slit::HORIZONTAL:
366 return string("Horizontal");
367 break;
368 }
369 // default string
370 return string("Vertical");
371}
372
373
374namespace { 296namespace {
375 297
376class AddWorkspaceCmd:public FbTk::Command { 298class AddWorkspaceCmd:public FbTk::Command {
@@ -422,6 +344,84 @@ void setupWorkspacemenu(BScreen &scr, FbTk::Menu &menu) {
422}; 344};
423 345
424 346
347template<>
348void Resource<Slit::Placement>::setFromString(const char *strval) {
349 if (strcasecmp(strval, "TopLeft")==0)
350 m_value = Slit::TOPLEFT;
351 else if (strcasecmp(strval, "CenterLeft")==0)
352 m_value = Slit::CENTERLEFT;
353 else if (strcasecmp(strval, "BottomLeft")==0)
354 m_value = Slit::BOTTOMLEFT;
355 else if (strcasecmp(strval, "TopCenter")==0)
356 m_value = Slit::TOPCENTER;
357 else if (strcasecmp(strval, "BottomCenter")==0)
358 m_value = Slit::BOTTOMCENTER;
359 else if (strcasecmp(strval, "TopRight")==0)
360 m_value = Slit::TOPRIGHT;
361 else if (strcasecmp(strval, "CenterRight")==0)
362 m_value = Slit::CENTERRIGHT;
363 else if (strcasecmp(strval, "BottomRight")==0)
364 m_value = Slit::BOTTOMRIGHT;
365 else
366 setDefaultValue();
367}
368
369template<>
370void Resource<Slit::Direction>::setFromString(const char *strval) {
371 if (strcasecmp(strval, "Vertical") == 0)
372 m_value = Slit::VERTICAL;
373 else if (strcasecmp(strval, "Horizontal") == 0)
374 m_value = Slit::HORIZONTAL;
375 else
376 setDefaultValue();
377}
378
379string Resource<Slit::Placement>::getString() {
380 switch (m_value) {
381 case Slit::TOPLEFT:
382 return string("TopLeft");
383 break;
384 case Slit::CENTERLEFT:
385 return string("CenterLeft");
386 break;
387 case Slit::BOTTOMLEFT:
388 return string("BottomLeft");
389 break;
390 case Slit::TOPCENTER:
391 return string("TopCenter");
392 break;
393 case Slit::BOTTOMCENTER:
394 return string("BottomCenter");
395 break;
396 case Slit::TOPRIGHT:
397 return string("TopRight");
398 break;
399 case Slit::CENTERRIGHT:
400 return string("CenterRight");
401 break;
402 case Slit::BOTTOMRIGHT:
403 return string("BottomRight");
404 break;
405 }
406 //default string
407 return string("BottomRight");
408}
409
410template<>
411string Resource<Slit::Direction>::getString() {
412 switch (m_value) {
413 case Slit::VERTICAL:
414 return string("Vertical");
415 break;
416 case Slit::HORIZONTAL:
417 return string("Horizontal");
418 break;
419 }
420 // default string
421 return string("Vertical");
422}
423
424
425template <> 425template <>
426void FbTk::ThemeItem<std::string>::load() { } 426void FbTk::ThemeItem<std::string>::load() { }
427 427
@@ -483,13 +483,13 @@ BScreen::ScreenResource::ScreenResource(ResourceManager &rm,
483 toolbar_on_head(rm, 0, scrname+".toolbar.onhead", altscrname+".Toolbar.onHead"), 483 toolbar_on_head(rm, 0, scrname+".toolbar.onhead", altscrname+".Toolbar.onHead"),
484 toolbar_placement(rm, Toolbar::BOTTOMCENTER, 484 toolbar_placement(rm, Toolbar::BOTTOMCENTER,
485 scrname+".toolbar.placement", altscrname+".Toolbar.Placement"), 485 scrname+".toolbar.placement", altscrname+".Toolbar.Placement"),
486 slit_auto_hide(rm, false, scrname+".slit.autoHide", altscrname+".Slit.AutoHide"), 486 slit_auto_hide(rm, false,
487 slit_placement(rm, Slit::BOTTOMRIGHT, 487 scrname+".slit.autoHide", altscrname+".Slit.AutoHide"),
488 scrname+".slit.placement", altscrname+".Slit.Placement"), 488 slit_placement(rm, Slit::BOTTOMRIGHT,
489 slit_direction(rm, Slit::VERTICAL, scrname+".slit.direction", altscrname+".Slit.Direction"), 489 scrname+".slit.placement", altscrname+".Slit.Placement"),
490 slit_alpha(rm, 255, scrname+".slit.alpha", altscrname+".Slit.Alpha") 490 slit_direction(rm, Slit::VERTICAL,
491 491 scrname+".slit.direction", altscrname+".Slit.Direction"),
492{ 492 slit_alpha(rm, 255, scrname+".slit.alpha", altscrname+".Slit.Alpha") {
493 493
494}; 494};
495 495
@@ -559,16 +559,15 @@ BScreen::BScreen(ResourceManager &rm,
559 559
560 XDefineCursor(disp, rootWindow().window(), fluxbox->getSessionCursor()); 560 XDefineCursor(disp, rootWindow().window(), fluxbox->getSessionCursor());
561 561
562 image_control = 562 m_image_control.reset(new FbTk::ImageControl(scrn, true, fluxbox->colorsPerChannel(),
563 new FbTk::ImageControl(scrn, true, fluxbox->colorsPerChannel(), 563 fluxbox->getCacheLife(), fluxbox->getCacheMax()));
564 fluxbox->getCacheLife(), fluxbox->getCacheMax()); 564 imageControl().installRootColormap();
565 image_control->installRootColormap();
566 root_colormap_installed = true; 565 root_colormap_installed = true;
567 566
568 fluxbox->load_rc(*this); 567 fluxbox->load_rc(*this);
569 FbTk::Menu::setAlpha(*resource.menu_alpha); 568 FbTk::Menu::setAlpha(*resource.menu_alpha);
570 569
571 image_control->setDither(*resource.image_dither); 570 imageControl().setDither(*resource.image_dither);
572 571
573 // setup windowtheme, toolbartheme for antialias 572 // setup windowtheme, toolbartheme for antialias
574 // before we load the theme 573 // before we load the theme
@@ -608,7 +607,7 @@ BScreen::BScreen(ResourceManager &rm,
608 geom_pixmap = None; 607 geom_pixmap = None;
609 geom_window.setBackgroundColor(winFrameTheme().titleFocusTexture().color()); 608 geom_window.setBackgroundColor(winFrameTheme().titleFocusTexture().color());
610 } else { 609 } else {
611 geom_pixmap = image_control->renderImage(geom_w, geom_h, 610 geom_pixmap = imageControl().renderImage(geom_w, geom_h,
612 winFrameTheme().titleFocusTexture()); 611 winFrameTheme().titleFocusTexture());
613 geom_window.setBackgroundPixmap(geom_pixmap); 612 geom_window.setBackgroundPixmap(geom_pixmap);
614 } 613 }
@@ -618,7 +617,7 @@ BScreen::BScreen(ResourceManager &rm,
618 geom_pixmap = None; 617 geom_pixmap = None;
619 geom_window.setBackgroundColor(winFrameTheme().labelFocusTexture().color()); 618 geom_window.setBackgroundColor(winFrameTheme().labelFocusTexture().color());
620 } else { 619 } else {
621 geom_pixmap = image_control->renderImage(geom_w, geom_h, 620 geom_pixmap = imageControl().renderImage(geom_w, geom_h,
622 winFrameTheme().labelFocusTexture()); 621 winFrameTheme().labelFocusTexture());
623 geom_window.setBackgroundPixmap(geom_pixmap); 622 geom_window.setBackgroundPixmap(geom_pixmap);
624 } 623 }
@@ -643,7 +642,7 @@ BScreen::BScreen(ResourceManager &rm,
643 Fluxbox::instance()->getSlitlistFilename().c_str())); 642 Fluxbox::instance()->getSlitlistFilename().c_str()));
644#endif // SLIT 643#endif // SLIT
645 644
646 m_toolbarhandler = new ToolbarHandler(*this, getToolbarMode()); 645 m_toolbarhandler.reset(new ToolbarHandler(*this, toolbarMode()));
647 646
648 setupWorkspacemenu(*this, *workspacemenu); 647 setupWorkspacemenu(*this, *workspacemenu);
649 648
@@ -739,7 +738,7 @@ BScreen::~BScreen() {
739 return; 738 return;
740 739
741 if (geom_pixmap != None) 740 if (geom_pixmap != None)
742 image_control->removeImage(geom_pixmap); 741 imageControl().removeImage(geom_pixmap);
743 742
744 743
745 removeWorkspaceNames(); 744 removeWorkspaceNames();
@@ -763,17 +762,15 @@ BScreen::~BScreen() {
763 for(; n_it != n_it_end; ++n_it) { 762 for(; n_it != n_it_end; ++n_it) {
764 delete (*n_it); 763 delete (*n_it);
765 } 764 }
766 netizenList.clear();
767
768 delete image_control;
769 765
766 netizenList.clear();
770} 767}
771 768
772const FbTk::Menu &BScreen::getToolbarModemenu() const { 769const FbTk::Menu &BScreen::toolbarModemenu() const {
773 return m_toolbarhandler->getModeMenu(); 770 return m_toolbarhandler->getModeMenu();
774} 771}
775 772
776FbTk::Menu &BScreen::getToolbarModemenu() { 773FbTk::Menu &BScreen::toolbarModemenu() {
777 return m_toolbarhandler->getModeMenu(); 774 return m_toolbarhandler->getModeMenu();
778} 775}
779 776
@@ -861,7 +858,7 @@ void BScreen::reconfigure() {
861 geom_pixmap = None; 858 geom_pixmap = None;
862 geom_window.setBackgroundColor(winFrameTheme().titleFocusTexture().color()); 859 geom_window.setBackgroundColor(winFrameTheme().titleFocusTexture().color());
863 } else { 860 } else {
864 geom_pixmap = image_control->renderImage(geom_w, geom_h, 861 geom_pixmap = imageControl().renderImage(geom_w, geom_h,
865 winFrameTheme().titleFocusTexture()); 862 winFrameTheme().titleFocusTexture());
866 geom_window.setBackgroundPixmap(geom_pixmap); 863 geom_window.setBackgroundPixmap(geom_pixmap);
867 } 864 }
@@ -871,13 +868,13 @@ void BScreen::reconfigure() {
871 geom_pixmap = None; 868 geom_pixmap = None;
872 geom_window.setBackgroundColor(winFrameTheme().labelFocusTexture().color()); 869 geom_window.setBackgroundColor(winFrameTheme().labelFocusTexture().color());
873 } else { 870 } else {
874 geom_pixmap = image_control->renderImage(geom_w, geom_h, 871 geom_pixmap = imageControl().renderImage(geom_w, geom_h,
875 winFrameTheme().labelFocusTexture()); 872 winFrameTheme().labelFocusTexture());
876 geom_window.setBackgroundPixmap(geom_pixmap); 873 geom_window.setBackgroundPixmap(geom_pixmap);
877 } 874 }
878 } 875 }
879 if (tmp) 876 if (tmp)
880 image_control->removeImage(tmp); 877 imageControl().removeImage(tmp);
881 878
882 geom_window.setBorderWidth(m_root_theme->borderWidth()); 879 geom_window.setBorderWidth(m_root_theme->borderWidth());
883 geom_window.setBorderColor(m_root_theme->borderColor()); 880 geom_window.setBorderColor(m_root_theme->borderColor());
@@ -936,10 +933,10 @@ void BScreen::reconfigure() {
936 } 933 }
937 934
938#ifdef SLIT 935#ifdef SLIT
939 if (m_slit.get()) { 936 if (slit()) {
940 m_slit->setPlacement(static_cast<Slit::Placement>(getSlitPlacement())); 937 slit()->setPlacement(static_cast<Slit::Placement>(getSlitPlacement()));
941 m_slit->setDirection(static_cast<Slit::Direction>(getSlitDirection())); 938 slit()->setDirection(static_cast<Slit::Direction>(getSlitDirection()));
942 m_slit->reconfigure(); 939 slit()->reconfigure();
943 } 940 }
944#endif // SLIT 941#endif // SLIT
945 942
@@ -953,7 +950,7 @@ void BScreen::reconfigure() {
953 iconList.end(), 950 iconList.end(),
954 mem_fun(&FluxboxWindow::reconfigure)); 951 mem_fun(&FluxboxWindow::reconfigure));
955 952
956 image_control->timeout(); 953 imageControl().timeout();
957 954
958} 955}
959 956