# # author: mathias gumz # about: # # enhances fluxbox to automatically shades unfocussed windows and # unshades focussed ones. # # init-file: # # session.autoShadeDelay: # session.autoUnshadeDelay: # # session.screen.autoShade: or via configmenu # # you can disable it per window via the windowmenu or the apps-file: # # [app] (xterm) # [autoshade] {no|yes} # [end] # ##################################################################### # the patch itself contains some modifications to fluxbox itself # which are kind of .. reordering nature for fluxbox, have nothing # todo with autoshading .. but since this patch is for testing only # ... :) have fun to try things out Index: src/Ewmh.cc =================================================================== --- src/Ewmh.cc (Revision 4052) +++ src/Ewmh.cc (Arbeitskopie) @@ -866,13 +866,15 @@ void Ewmh::setState(FluxboxWindow &win, Atom state, bool value) { if (state == m_net_wm_state_sticky) { // STICKY - if (value && !win.isStuck() || - (!value && win.isStuck())) + if (value) win.stick(); + else + win.unstick(); } else if (state == m_net_wm_state_shaded) { // SHADED - if ((value && !win.isShaded()) || - (!value && win.isShaded())) + if (value) win.shade(); + else + win.unshade(); } else if (state == m_net_wm_state_maximized_horz ) { // maximized Horizontal if ((value && !win.isMaximized()) || (!value && win.isMaximized())) @@ -906,7 +908,7 @@ if (state == m_net_wm_state_sticky) { win.stick(); } else if (state == m_net_wm_state_shaded){ - win.shade(); + win.toggleShade(); } else if (state == m_net_wm_state_maximized_horz ) { // maximized Horizontal win.maximizeHorizontal(); } else if (state == m_net_wm_state_maximized_vert) { // maximized Vertical Index: src/Gnome.cc =================================================================== --- src/Gnome.cc (Revision 4052) +++ src/Gnome.cc (Arbeitskopie) @@ -362,10 +362,9 @@ #ifdef DEBUG cerr<<"Gnome state: Sticky"<isStuck()) - win->stick(); - } else if (win->isStuck()) win->stick(); + } else + win->unstick(); if (state & WIN_STATE_MINIMIZED) { #ifdef DEBUG @@ -380,10 +379,9 @@ #ifdef DEBUG cerr<<"Gnome state: Shade"<isShaded()) - win->shade(); - } else if (win->isShaded()) win->shade(); + } else + win->unshade(); if (state & WIN_STATE_HIDDEN) { Index: src/Screen.cc =================================================================== --- src/Screen.cc (Revision 4052) +++ src/Screen.cc (Arbeitskopie) @@ -169,10 +169,10 @@ show_window_pos(rm, true, scrname+".showwindowposition", altscrname+".ShowWindowPosition"), focus_last(rm, true, scrname+".focusLastWindow", altscrname+".FocusLastWindow"), focus_new(rm, true, scrname+".focusNewWindows", altscrname+".FocusNewWindows"), - antialias(rm, false, scrname+".antialias", altscrname+".Antialias"), auto_raise(rm, false, scrname+".autoRaise", altscrname+".AutoRaise"), click_raises(rm, true, scrname+".clickRaises", altscrname+".ClickRaises"), decorate_transient(rm, false, scrname+".decorateTransient", altscrname+".DecorateTransient"), + auto_shade(rm, false, scrname+".autoShade", altscrname+".AutoShade"), rootcommand(rm, "", scrname+".rootCommand", altscrname+".RootCommand"), resize_model(rm, BOTTOMRESIZE, scrname+".resizeMode", altscrname+".ResizeMode"), windowmenufile(rm, "", scrname+".windowMenu", altscrname+".WindowMenu"), @@ -1793,6 +1793,8 @@ _BOOLITEM(Configmenu, ClickRaises, "Click Raises", "Click Raises", *resource.click_raises, saverc_cmd); + // TODO: create nls-entry + menu.insert(new BoolMenuItem("AutoShade", *resource.auto_shade, saverc_cmd)); #ifdef HAVE_XRENDER if (FbTk::Transparent::haveRender() || Index: src/Window.cc =================================================================== --- src/Window.cc (Revision 4052) +++ src/Window.cc (Arbeitskopie) @@ -271,9 +271,11 @@ WinClient &m_client; }; -}; +}; // end of anonymous namespace +typedef FbTk::RefCount CommandRef; + int FluxboxWindow::s_num_grabs = 0; FluxboxWindow::FluxboxWindow(WinClient &client, FbWinFrameTheme &tm, @@ -347,7 +349,9 @@ m_labelbuttons.clear(); - m_timer.stop(); + m_autoraise_timer.stop(); + m_autoshade_timer.stop(); + m_autounshade_timer.stop(); // notify die m_diesig.notify(); @@ -452,7 +456,8 @@ decorations.sticky = decorations.shade = decorations.tab = true; - functions.resize = functions.move = functions.iconify = functions.maximize = functions.tabable = true; + functions.resize = functions.move = functions.iconify = + functions.maximize = functions.tabable = functions.autoshade = true; decorations.close = false; if (m_client->getBlackboxHint() != 0) @@ -473,12 +478,26 @@ m_client->old_bw = wattrib.border_width; m_client->x = wattrib.x; m_client->y = wattrib.y; - m_timer.setTimeout(fluxbox.getAutoRaiseDelay()); - FbTk::RefCount raise_cmd(new FbTk::SimpleCommand(*this, - &FluxboxWindow::raise)); - m_timer.setCommand(raise_cmd); - m_timer.fireOnce(true); + m_autoraise_timer.setTimeout(fluxbox.getAutoRaiseDelay()); + CommandRef raise_cmd(new SimpleCommand(*this, + &FluxboxWindow::raise)); + m_autoraise_timer.setCommand(raise_cmd); + m_autoraise_timer.fireOnce(true); + m_autoshade_timer.setTimeout(fluxbox.getAutoShadeDelay()); + CommandRef shade_cmd(new SimpleCommand(*this, + &FluxboxWindow::shade)); + m_autoshade_timer.setCommand(shade_cmd); + m_autoshade_timer.fireOnce(true); + + m_autounshade_timer.setTimeout(fluxbox.getAutoUnshadeDelay()); + CommandRef unshade_cmd(new SimpleCommand(*this, + &FluxboxWindow::unshade)); + m_autounshade_timer.setCommand(unshade_cmd); + m_autounshade_timer.fireOnce(true); + + + Fluxbox::instance()->saveWindowSearchGroup(frame().window().window(), this); /**************************************************/ @@ -1640,8 +1659,7 @@ if (isIconic()) deiconify(); - if (isShaded()) - shade(); + unshade(); int head = screen().getHead(frame().window()); int new_x = frame().x(), @@ -1771,54 +1789,75 @@ } } + +void FluxboxWindow::toggleShade() { + if (isShaded()) + unshade(); + else + shade(); +} + void FluxboxWindow::shade() { // we can only shade if we have a titlebar if (!decorations.titlebar) return; - frame().shade(); + if (!isShaded()) + frame().shade(); - if (shaded) { - shaded = false; - m_blackbox_attrib.flags ^= ATTRIB_SHADED; - m_blackbox_attrib.attrib ^= ATTRIB_SHADED; - - if (isInitialized()) - setState(NormalState, false); - } else { - shaded = true; - m_blackbox_attrib.flags |= ATTRIB_SHADED; - m_blackbox_attrib.attrib |= ATTRIB_SHADED; - // shading is the same as iconic - if (isInitialized()) - setState(IconicState, false); - } - + shaded = true; + m_blackbox_attrib.flags |= ATTRIB_SHADED; + m_blackbox_attrib.attrib |= ATTRIB_SHADED; + // shading is the same as iconic + if (isInitialized()) + setState(IconicState, false); } +void FluxboxWindow::unshade() { -void FluxboxWindow::stick() { + if (isShaded()) + frame().shade(); - if (stuck) { - m_blackbox_attrib.flags ^= ATTRIB_OMNIPRESENT; - m_blackbox_attrib.attrib ^= ATTRIB_OMNIPRESENT; + shaded = false; + m_blackbox_attrib.flags ^= ATTRIB_SHADED; + m_blackbox_attrib.attrib ^= ATTRIB_SHADED; - stuck = false; + if (isInitialized()) + setState(IconicState, false); +} + - } else { - stuck = true; +void FluxboxWindow::toggleSticky() { + if (isStuck()) + unstick(); + else + stick(); +} - m_blackbox_attrib.flags |= ATTRIB_OMNIPRESENT; - m_blackbox_attrib.attrib |= ATTRIB_OMNIPRESENT; +void FluxboxWindow::stick() { + + stuck = true; + m_blackbox_attrib.flags |= ATTRIB_OMNIPRESENT; + m_blackbox_attrib.attrib |= ATTRIB_OMNIPRESENT; + if (isInitialized()) { + setState(m_current_state, false); + // notify since some things consider "stuck" to be a pseudo-workspace + m_workspacesig.notify(); } +} +void FluxboxWindow::unstick() { + + stuck = false; + m_blackbox_attrib.flags ^= ATTRIB_OMNIPRESENT; + m_blackbox_attrib.attrib ^= ATTRIB_OMNIPRESENT; + if (isInitialized()) { setState(m_current_state, false); // notify since some things consider "stuck" to be a pseudo-workspace m_workspacesig.notify(); } - } @@ -2045,11 +2084,22 @@ if ((screen().isSloppyFocus() || screen().isSemiSloppyFocus()) && screen().doAutoRaise()) { if (focused) - m_timer.start(); + m_autoraise_timer.start(); else - m_timer.stop(); + m_autoraise_timer.stop(); } + if (isAutoShadeable() && screen().doAutoShade() && isVisible()) { + if (!focused) { + m_autoshade_timer.start(); + m_autounshade_timer.stop(); + } + else { + m_autounshade_timer.start(); + m_autoshade_timer.stop(); + } + } + // did focus change? notify listeners if (was_focused != focus) m_focussig.notify(); @@ -2935,6 +2985,10 @@ } } + + if (inside_titlebar && screen().doAutoShade() && functions.autoshade) { + // TODO: add unshade on mouseover here for clickToFocus + } } void FluxboxWindow::enterNotifyEvent(XCrossingEvent &ev) { @@ -3780,11 +3834,11 @@ CommandRef maximize_vert_cmd(new WindowCmd(*this, &FluxboxWindow::maximizeVertical)); CommandRef maximize_horiz_cmd(new WindowCmd(*this, &FluxboxWindow::maximizeHorizontal)); CommandRef close_cmd(new WindowCmd(*this, &FluxboxWindow::close)); - CommandRef shade_cmd(new WindowCmd(*this, &FluxboxWindow::shade)); + CommandRef shade_cmd(new WindowCmd(*this, &FluxboxWindow::toggleShade)); CommandRef raise_cmd(new WindowCmd(*this, &FluxboxWindow::raise)); CommandRef lower_cmd(new WindowCmd(*this, &FluxboxWindow::lower)); CommandRef raise_and_focus_cmd(new WindowCmd(*this, &FluxboxWindow::raiseAndFocus)); - CommandRef stick_cmd(new WindowCmd(*this, &FluxboxWindow::stick)); + CommandRef stick_cmd(new WindowCmd(*this, &FluxboxWindow::toggleSticky)); CommandRef show_menu_cmd(new WindowCmd(*this, &FluxboxWindow::popupMenu)); // clear old buttons from frame Index: src/fluxbox.hh =================================================================== --- src/fluxbox.hh (Revision 4052) +++ src/fluxbox.hh (Arbeitskopie) @@ -154,6 +154,8 @@ inline time_t getAutoRaiseDelay() const { return *m_rc_auto_raise_delay; } + inline time_t getAutoShadeDelay() const { return *m_rc_auto_shade_delay; } + inline time_t getAutoUnshadeDelay() const { return *m_rc_auto_unshade_delay; } inline unsigned int getCacheLife() const { return *m_rc_cache_life * 60000; } inline unsigned int getCacheMax() const { return *m_rc_cache_max; } @@ -271,6 +273,8 @@ FbTk::Resource m_rc_tabs_attach_area; FbTk::Resource m_rc_cache_life, m_rc_cache_max; FbTk::Resource m_rc_auto_raise_delay; + FbTk::Resource m_rc_auto_shade_delay; + FbTk::Resource m_rc_auto_unshade_delay; FbTk::Resource m_rc_use_mod1; /// temporary!, to disable mod1 for resize/move typedef std::map WinClientMap; Index: src/Remember.hh =================================================================== --- src/Remember.hh (Revision 4052) +++ src/Remember.hh (Arbeitskopie) @@ -57,6 +57,7 @@ inline void forgetJumpworkspace() { jumpworkspace_remember = false; } inline void forgetLayer() { layer_remember = false; } inline void forgetSaveOnClose() { save_on_close_remember = false; } + inline void forgetAutoShade() { autoshade_remember = false; } inline void rememberWorkspace(int ws) { workspace = ws; workspace_remember = true; } @@ -84,8 +85,9 @@ { layer = layernum; layer_remember = true; } inline void rememberSaveOnClose(bool state) { save_on_close = state; save_on_close_remember = true; } + inline void rememberAutoShade(bool state) + { autoshade = state; autoshade_remember = true; } - bool workspace_remember; unsigned int workspace; @@ -129,6 +131,9 @@ bool save_on_close_remember; bool save_on_close; + bool autoshade_remember; + bool autoshade; + bool is_grouped; FluxboxWindow *group; @@ -160,6 +165,7 @@ //REM_TABSTATE, ... external tabs disabled atm REM_WORKSPACE, REM_HEAD, + REM_AUTOSHADE, REM_LASTATTRIB // not actually used }; Index: src/MenuCreator.cc =================================================================== --- src/MenuCreator.cc (Revision 4052) +++ src/MenuCreator.cc (Arbeitskopie) @@ -455,7 +455,7 @@ _FB_USES_NLS; if (type == "shade") { - RefCmd shade_cmd(new WindowCmd(win, &FluxboxWindow::shade)); + RefCmd shade_cmd(new WindowCmd(win, &FluxboxWindow::toggleShade)); menu.insert(label.empty()?_FBTEXT(Windowmenu, Shade, "Shade", "Shade the window"):label.c_str(), shade_cmd); } else if (type == "maximize") { RefCmd maximize_cmd(new WindowCmd(win, &FluxboxWindow::maximizeFull)); @@ -486,8 +486,11 @@ RefCmd raise_cmd(new WindowCmd(win, &FluxboxWindow::raise)); menu.insert(label.empty()?_FBTEXT(Windowmenu, Raise, "Raise", "Raise the window"):label.c_str(), raise_cmd); } else if (type == "stick") { - RefCmd stick_cmd(new WindowCmd(win, &FluxboxWindow::stick)); + RefCmd stick_cmd(new WindowCmd(win, &FluxboxWindow::toggleSticky)); menu.insert(label.empty()?_FBTEXT(Windowmenu, Stick, "Stick", "Stick the window"):label.c_str(), stick_cmd); + } else if (type == "autoshade") { + RefCmd autoshade_cmd(new WindowCmd(win, &FluxboxWindow::toggleAutoShade)); + menu.insert(label.empty()?"AutoShade":label.c_str(), autoshade_cmd); } else if (type == "extramenus") { FluxboxWindow::ExtraMenus::iterator it = win.extraMenus().begin(); FluxboxWindow::ExtraMenus::iterator it_end = win.extraMenus().end(); Index: src/FbTk/SimpleCommand.hh =================================================================== --- src/FbTk/SimpleCommand.hh (Revision 4052) +++ src/FbTk/SimpleCommand.hh (Arbeitskopie) @@ -26,6 +26,7 @@ namespace FbTk { + /// a simple command template class SimpleCommand: public Command { Index: src/FbTk/ThemeItems.cc =================================================================== --- src/FbTk/ThemeItems.cc (Revision 4052) +++ src/FbTk/ThemeItems.cc (Arbeitskopie) @@ -131,6 +131,8 @@ FbTk::Color shadow_color(ThemeManager::instance().resourceValue(name()+".shadow.color", altName()+".Shadow.Color").c_str(), theme().screenNum()); + printf("%s\n", ThemeManager::instance().resourceValue(name()+".shadow.color", altName()+".Shadow.Color").c_str()); + m_value.setShadow(true); m_value.setShadowColor(shadow_color); m_value.setShadowOffX(atoi(ThemeManager::instance().resourceValue(name()+".shadow.x", altName()+".Shadow.X").c_str())); Index: src/FbTk/Compose.hh =================================================================== --- src/FbTk/Compose.hh (Revision 4052) +++ src/FbTk/Compose.hh (Arbeitskopie) @@ -1,5 +1,5 @@ // Composer.hh -// Copyright (c) 2003 Henrik Kinnunen (fluxgen at fluxbox dot org) +// Copyright (c) 2003 - 2005 Henrik Kinnunen (fluxgen at fluxbox dot org) // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), Index: src/FbCommandFactory.cc =================================================================== --- src/FbCommandFactory.cc (Revision 4052) +++ src/FbCommandFactory.cc (Arbeitskopie) @@ -126,6 +126,9 @@ "taketonextworkspace", "taketoprevworkspace", "toggledecor", + "toggleshade", + "togglesticky", + "toggleautoshade", "windowmenu", "workspace", /* NOTE: The following are DEPRECATED and subject to removal */ @@ -307,12 +310,14 @@ return new CurrentWindowCmd(&FluxboxWindow::lowerLayer); else if (command == "close") return new CurrentWindowCmd(&FluxboxWindow::close); - else if (command == "shade" || command == "shadewindow") - return new CurrentWindowCmd(&FluxboxWindow::shade); - else if (command == "stick" || command == "stickwindow") - return new CurrentWindowCmd(&FluxboxWindow::stick); + else if (command == "shade" || command == "shadewindow" || command == "toggleshade") + return new CurrentWindowCmd(&FluxboxWindow::toggleShade); + else if (command == "stick" || command == "stickwindow" || command == "togglesticky") + return new CurrentWindowCmd(&FluxboxWindow::toggleSticky); else if (command == "toggledecor") return new CurrentWindowCmd(&FluxboxWindow::toggleDecoration); + else if (command == "toggleautoshade") + return new CurrentWindowCmd(&FluxboxWindow::toggleAutoShade); else if (command == "sethead") return new SetHeadCmd(atoi(arguments.c_str())); else if (command == "sendtoworkspace") Index: src/fluxbox.cc =================================================================== --- src/fluxbox.cc (Revision 4052) +++ src/fluxbox.cc (Arbeitskopie) @@ -220,6 +220,8 @@ m_rc_cache_life(m_resourcemanager, 5, "session.cacheLife", "Session.CacheLife"), m_rc_cache_max(m_resourcemanager, 200, "session.cacheMax", "Session.CacheMax"), m_rc_auto_raise_delay(m_resourcemanager, 250, "session.autoRaiseDelay", "Session.AutoRaiseDelay"), + m_rc_auto_shade_delay(m_resourcemanager, 250, "session.autoShadeDelay", "Session.AutoShadeDelay"), + m_rc_auto_unshade_delay(m_resourcemanager, 250, "session.autoUnshadeDelay", "Session.AutoUnshadeDelay"), m_rc_use_mod1(m_resourcemanager, true, "session.useMod1", "Session.UseMod1"), m_focused_window(0), m_masked_window(0), m_mousescreen(0), Index: src/Remember.cc =================================================================== --- src/Remember.cc (Revision 4052) +++ src/Remember.cc (Arbeitskopie) @@ -132,6 +132,8 @@ remember, win, Remember::REM_DECOSTATE)); menu->insert(new RememberMenuItem(_FBTEXT(Remember, Shaded, "Shaded", "Remember shaded"), remember, win, Remember::REM_SHADEDSTATE)); + //TODO: nls entry + menu->insert(new RememberMenuItem("AutoShade", remember, win, Remember::REM_AUTOSHADE)); menu->insert(new RememberMenuItem(_FBTEXT(Remember, Layer, "Layer", "Remember Layer"), remember, win, Remember::REM_LAYER)); menu->insert(new RememberMenuItem(_FBTEXT(Remember, SaveOnClose, "Save on close", "Save remembered attributes on close"), @@ -428,6 +430,8 @@ app.rememberJumpworkspace((str_label=="yes")); } else if (str_key == "Close") { app.rememberSaveOnClose((str_label=="yes")); + } else if (str_key == "AutoShade") { + app.rememberAutoShade((str_label=="yes")); } else if (str_key == "end") { return row; } else { @@ -644,6 +648,10 @@ if (a.save_on_close_remember) { apps_file << " [Close]\t{" << ((a.save_on_close)?"yes":"no") << "}" << endl; } + if (a.autoshade_remember) { + apps_file << " [AutoShade]\t{" << (a.autoshade_remember ? "yes" : "no") << "}" << endl; + } + apps_file << "[end]" << endl; } } @@ -691,6 +699,9 @@ case REM_SAVEONCLOSE: return app->save_on_close_remember; break; + case REM_AUTOSHADE: + return app->autoshade_remember; + break; case REM_LASTATTRIB: default: return false; // should never get here @@ -744,6 +755,9 @@ case REM_SAVEONCLOSE: app->rememberSaveOnClose(true); break; + case REM_AUTOSHADE: + app->rememberAutoShade(win->isAutoShadeable()); + break; case REM_LASTATTRIB: default: // nothing @@ -798,6 +812,9 @@ case REM_SAVEONCLOSE: app->forgetSaveOnClose(); break; + case REM_AUTOSHADE: + app->forgetAutoShade(); + break; case REM_LASTATTRIB: default: // nothing @@ -882,7 +899,7 @@ // if inconsistent... if (win.isShaded() && !app->shadedstate || !win.isShaded() && app->shadedstate) - win.shade(); // toggles + win.toggleShade(); // external tabs aren't available atm... //if (app->tabstate_remember) ... @@ -891,7 +908,7 @@ // if inconsistent... if (win.isStuck() && !app->stuckstate || !win.isStuck() && app->stuckstate) - win.stick(); // toggles + win.toggleSticky(); if (app->focushiddenstate_remember) win.setFocusHidden(true); if (app->iconhiddenstate_remember) @@ -900,6 +917,8 @@ if (app->layer_remember) win.moveToLayer(app->layer); + if (app->autoshade_remember) + win.setAutoShadeable(app->autoshade); } void Remember::setupClient(WinClient &winclient) { Index: src/Screen.hh =================================================================== --- src/Screen.hh (Revision 4052) +++ src/Screen.hh (Arbeitskopie) @@ -105,40 +105,40 @@ void initWindows(); void initMenus(); - inline bool isSloppyFocus() const { return (*resource.focus_model == SLOPPYFOCUS); } - inline bool isSemiSloppyFocus() const { return (*resource.focus_model == SEMISLOPPYFOCUS); } - inline bool isRootColormapInstalled() const { return root_colormap_installed; } - inline bool isScreenManaged() const { return managed; } - inline bool isSloppyWindowGrouping() const { return *resource.sloppy_window_grouping; } - inline bool isWorkspaceWarping() const { return *resource.workspace_warping; } - inline bool isDesktopWheeling() const { return *resource.desktop_wheeling; } - inline bool doAutoRaise() const { return *resource.auto_raise; } - inline bool clickRaises() const { return *resource.click_raises; } - inline bool doOpaqueMove() const { return *resource.opaque_move; } - inline bool doFullMax() const { return *resource.full_max; } - inline bool doFocusNew() const { return *resource.focus_new; } - inline bool doFocusLast() const { return *resource.focus_last; } - inline bool doShowWindowPos() const { return *resource.show_window_pos; } - inline bool antialias() const { return *resource.antialias; } - inline bool decorateTransient() const { return *resource.decorate_transient; } - inline const std::string &windowMenuFilename() const { return *resource.windowmenufile; } - inline FbTk::ImageControl &imageControl() { return *m_image_control.get(); } + bool isSloppyFocus() const { return (*resource.focus_model == SLOPPYFOCUS); } + bool isSemiSloppyFocus() const { return (*resource.focus_model == SEMISLOPPYFOCUS); } + bool isRootColormapInstalled() const { return root_colormap_installed; } + bool isScreenManaged() const { return managed; } + bool isSloppyWindowGrouping() const { return *resource.sloppy_window_grouping; } + bool isWorkspaceWarping() const { return *resource.workspace_warping; } + bool isDesktopWheeling() const { return *resource.desktop_wheeling; } + bool doAutoRaise() const { return *resource.auto_raise; } + bool doAutoShade() const { return *resource.auto_shade; } + bool clickRaises() const { return *resource.click_raises; } + bool doOpaqueMove() const { return *resource.opaque_move; } + bool doFullMax() const { return *resource.full_max; } + bool doFocusNew() const { return *resource.focus_new; } + bool doFocusLast() const { return *resource.focus_last; } + bool doShowWindowPos() const { return *resource.show_window_pos; } + bool decorateTransient() const { return *resource.decorate_transient; } + const std::string &windowMenuFilename() const { return *resource.windowmenufile; } + FbTk::ImageControl &imageControl() { return *m_image_control.get(); } const FbTk::Menu &getRootmenu() const { return *m_rootmenu.get(); } FbTk::Menu &getRootmenu() { return *m_rootmenu.get(); } const FbTk::Menu &configMenu() const { return *m_configmenu.get(); } FbTk::Menu &configMenu() { return *m_configmenu.get(); } - inline const std::string &getRootCommand() const { return *resource.rootcommand; } - inline ResizeModel getResizeModel() const { return *resource.resize_model; } - inline FocusModel getFocusModel() const { return *resource.focus_model; } - inline FollowModel getFollowModel() const { return *resource.follow_model; } + const std::string &getRootCommand() const { return *resource.rootcommand; } + ResizeModel getResizeModel() const { return *resource.resize_model; } + FocusModel getFocusModel() const { return *resource.focus_model; } + FollowModel getFollowModel() const { return *resource.follow_model; } - inline Slit *slit() { return m_slit.get(); } - inline const Slit *slit() const { return m_slit.get(); } + Slit *slit() { return m_slit.get(); } + const Slit *slit() const { return m_slit.get(); } - inline Workspace *getWorkspace(unsigned int w) { return ( w < m_workspaces_list.size() ? m_workspaces_list[w] : 0); } - inline Workspace *currentWorkspace() { return m_current_workspace; } - inline const Workspace *currentWorkspace() const { return m_current_workspace; } + Workspace *getWorkspace(unsigned int w) { return ( w < m_workspaces_list.size() ? m_workspaces_list[w] : 0); } + Workspace *currentWorkspace() { return m_current_workspace; } + const Workspace *currentWorkspace() const { return m_current_workspace; } const FbTk::Menu &getWorkspacemenu() const { return *m_workspacemenu.get(); } FbTk::Menu &getWorkspacemenu() { return *m_workspacemenu.get(); } @@ -157,18 +157,18 @@ /// @return true if dock app was added, else false bool addKdeDockapp(Window win); - inline unsigned int width() const { return rootWindow().width(); } - inline unsigned int height() const { return rootWindow().height(); } - inline int screenNumber() const { return rootWindow().screenNumber(); } + unsigned int width() const { return rootWindow().width(); } + unsigned int height() const { return rootWindow().height(); } + int screenNumber() const { return rootWindow().screenNumber(); } /// @return number of workspaces - inline unsigned int getCount() const { return m_workspaces_list.size(); } + unsigned int getCount() const { return m_workspaces_list.size(); } /// @return number of icons - inline unsigned int getIconCount() const { return m_icon_list.size(); } - inline const Icons &getIconList() const { return m_icon_list; } - inline Icons &getIconList() { return m_icon_list; } - inline const FocusedWindows &getFocusedList() const { return focused_list; } - inline FocusedWindows &getFocusedList() { return focused_list; } + unsigned int getIconCount() const { return m_icon_list.size(); } + const Icons &getIconList() const { return m_icon_list; } + Icons &getIconList() { return m_icon_list; } + const FocusedWindows &getFocusedList() const { return focused_list; } + FocusedWindows &getFocusedList() { return focused_list; } WinClient *getLastFocusedWindow(int workspace = -1); WinClient *getLastFocusedWindow(FluxboxWindow &group, WinClient *ignore_client = 0); const Workspaces &getWorkspacesList() const { return m_workspaces_list; } @@ -204,45 +204,45 @@ void hideWindowMenus(const FluxboxWindow* except= 0); /// @return the resource value of number of workspace - inline int getNumberOfWorkspaces() const { return *resource.workspaces; } + int getNumberOfWorkspaces() const { return *resource.workspaces; } - inline PlacementPolicy getPlacementPolicy() const { return *resource.placement_policy; } - inline int getEdgeSnapThreshold() const { return *resource.edge_snap_threshold; } - inline RowDirection getRowPlacementDirection() const { return *resource.row_direction; } - inline ColumnDirection getColPlacementDirection() const { return *resource.col_direction; } + PlacementPolicy getPlacementPolicy() const { return *resource.placement_policy; } + int getEdgeSnapThreshold() const { return *resource.edge_snap_threshold; } + RowDirection getRowPlacementDirection() const { return *resource.row_direction; } + ColumnDirection getColPlacementDirection() const { return *resource.col_direction; } - inline void setRootColormapInstalled(bool r) { root_colormap_installed = r; } - inline void saveRootCommand(std::string rootcmd) { *resource.rootcommand = rootcmd; } - inline void saveFocusModel(FocusModel model) { resource.focus_model = model; } - inline void saveWorkspaces(int w) { *resource.workspaces = w; } + void setRootColormapInstalled(bool r) { root_colormap_installed = r; } + void saveRootCommand(std::string rootcmd) { *resource.rootcommand = rootcmd; } + void saveFocusModel(FocusModel model) { resource.focus_model = model; } + void saveWorkspaces(int w) { *resource.workspaces = w; } void saveMenu(FbTk::Menu &menu) { m_rootmenu_list.push_back(&menu); } - inline FbWinFrameTheme &winFrameTheme() { return *m_windowtheme.get(); } - inline const FbWinFrameTheme &winFrameTheme() const { return *m_windowtheme.get(); } - inline MenuTheme &menuTheme() { return *m_menutheme.get(); } - inline const MenuTheme &menuTheme() const { return *m_menutheme.get(); } - inline const RootTheme &rootTheme() const { return *m_root_theme.get(); } - inline WinButtonTheme &winButtonTheme() { return *m_winbutton_theme.get(); } - inline const WinButtonTheme &winButtonTheme() const { return *m_winbutton_theme.get(); } + FbWinFrameTheme &winFrameTheme() { return *m_windowtheme.get(); } + const FbWinFrameTheme &winFrameTheme() const { return *m_windowtheme.get(); } + MenuTheme &menuTheme() { return *m_menutheme.get(); } + const MenuTheme &menuTheme() const { return *m_menutheme.get(); } + const RootTheme &rootTheme() const { return *m_root_theme.get(); } + WinButtonTheme &winButtonTheme() { return *m_winbutton_theme.get(); } + const WinButtonTheme &winButtonTheme() const { return *m_winbutton_theme.get(); } - inline FbRootWindow &rootWindow() { return m_root_window; } - inline const FbRootWindow &rootWindow() const { return m_root_window; } + FbRootWindow &rootWindow() { return m_root_window; } + const FbRootWindow &rootWindow() const { return m_root_window; } - inline FbTk::MultLayers &layerManager() { return m_layermanager; } - inline const FbTk::MultLayers &layerManager() const { return m_layermanager; } - inline FbTk::ResourceManager &resourceManager() { return m_resource_manager; } - inline const FbTk::ResourceManager &resourceManager() const { return m_resource_manager; } - inline const std::string &name() const { return m_name; } - inline const std::string &altName() const { return m_altname; } - inline bool isShuttingdown() const { return m_shutdown; } + FbTk::MultLayers &layerManager() { return m_layermanager; } + const FbTk::MultLayers &layerManager() const { return m_layermanager; } + FbTk::ResourceManager &resourceManager() { return m_resource_manager; } + const FbTk::ResourceManager &resourceManager() const { return m_resource_manager; } + const std::string &name() const { return m_name; } + const std::string &altName() const { return m_altname; } + bool isShuttingdown() const { return m_shutdown; } int addWorkspace(); int removeLastWorkspace(); // scroll workspaces - inline void nextWorkspace() { nextWorkspace(1); } - inline void prevWorkspace() { prevWorkspace(1); } + void nextWorkspace() { nextWorkspace(1); } + void prevWorkspace() { prevWorkspace(1); } void nextWorkspace(int delta); void prevWorkspace(int delta); void rightWorkspace(int delta); @@ -266,8 +266,8 @@ bool changeworkspace=true); void reassociateWindow(FluxboxWindow *window, unsigned int workspace_id, bool ignore_sticky); - inline void prevFocus() { prevFocus(0); } - inline void nextFocus() { nextFocus(0); } + void prevFocus() { prevFocus(0); } + void nextFocus() { nextFocus(0); } void prevFocus(int options); void nextFocus(int options); void raiseFocus(); @@ -297,8 +297,8 @@ void updateSize(); // Xinerama-related functions - inline bool hasXinerama() const { return m_xinerama_avail; } - inline int numHeads() const { return m_xinerama_num_heads; } + bool hasXinerama() const { return m_xinerama_avail; } + int numHeads() const { return m_xinerama_num_heads; } void initXinerama(); @@ -434,7 +434,7 @@ sloppy_window_grouping, workspace_warping, desktop_wheeling, show_window_pos, focus_last, focus_new, - antialias, auto_raise, click_raises, decorate_transient; + auto_raise, click_raises, decorate_transient, auto_shade; FbTk::Resource rootcommand; FbTk::Resource resize_model; FbTk::Resource windowmenufile; Index: src/Window.hh =================================================================== --- src/Window.hh (Revision 4052) +++ src/Window.hh (Arbeitskopie) @@ -209,10 +209,15 @@ void maximizeVertical(); /// maximizes the window fully void maximizeFull(); - /// toggles shade + /// shade functions + void toggleShade(); void shade(); + void unshade(); /// toggles sticky + void toggleSticky(); void stick(); + void unstick(); + void raise(); void lower(); void tempRaise(); @@ -280,42 +285,46 @@ unsigned int getWmState() const { return m_current_state; } // whether this window can be tabbed with other windows, // and others tabbed with it - inline void setTabable(bool tabable) { functions.tabable = tabable; } - inline bool isTabable() { return functions.tabable; } - inline void setMovable(bool movable) { functions.move = movable; } - inline void setResizable(bool resizable) { functions.resize = resizable; } - - inline bool isFocusHidden() const { return (m_blackbox_attrib.flags & ATTRIB_HIDDEN); } - inline bool isIconHidden() const { return m_icon_hidden; } - inline bool isManaged() const { return m_initialized; } - inline bool isInitialized() const { return m_initialized; } - inline bool isFocused() const { return focused; } + void setTabable(bool tabable) { functions.tabable = tabable; } + void setMovable(bool movable) { functions.move = movable; } + void setResizable(bool resizable) { functions.resize = resizable; } + void setAutoShadeable(bool autoshadeable) { functions.autoshade = autoshadeable; } + + void toggleAutoShade() { setAutoShadeable(!isAutoShadeable()); } + + bool isTabable() { return functions.tabable; } + bool isFocusHidden() const { return (m_blackbox_attrib.flags & ATTRIB_HIDDEN); } + bool isIconHidden() const { return m_icon_hidden; } + bool isManaged() const { return m_initialized; } + bool isInitialized() const { return m_initialized; } + bool isFocused() const { return focused; } bool isVisible() const; - inline bool isIconic() const { return iconic; } - inline bool isShaded() const { return shaded; } - inline bool isFullscreen() const { return fullscreen; } - inline bool isMaximized() const { return maximized == MAX_FULL; } - inline bool isIconifiable() const { return functions.iconify; } - inline bool isMaximizable() const { return functions.maximize; } - inline bool isResizable() const { return functions.resize; } - inline bool isClosable() const { return functions.close; } - inline bool isStuck() const { return stuck; } - inline bool hasTitlebar() const { return decorations.titlebar; } - inline bool isMoving() const { return moving; } - inline bool isResizing() const { return resizing; } + bool isIconic() const { return iconic; } + bool isShaded() const { return shaded; } + bool isFullscreen() const { return fullscreen; } + bool isMaximized() const { return maximized == MAX_FULL; } + bool isIconifiable() const { return functions.iconify; } + bool isMaximizable() const { return functions.maximize; } + bool isResizable() const { return functions.resize; } + bool isClosable() const { return functions.close; } + bool isAutoShadeable() const { return functions.autoshade; } + bool isStuck() const { return stuck; } + bool hasTitlebar() const { return decorations.titlebar; } + bool isMoving() const { return moving; } + bool isResizing() const { return resizing; } bool isGroupable() const; - inline int numClients() const { return m_clientlist.size(); } - inline bool empty() const { return m_clientlist.empty(); } - inline ClientList &clientList() { return m_clientlist; } - inline const ClientList &clientList() const { return m_clientlist; } - inline WinClient &winClient() { return *m_client; } - inline const WinClient &winClient() const { return *m_client; } + int numClients() const { return m_clientlist.size(); } + bool empty() const { return m_clientlist.empty(); } + ClientList &clientList() { return m_clientlist; } + const ClientList &clientList() const { return m_clientlist; } + WinClient &winClient() { return *m_client; } + const WinClient &winClient() const { return *m_client; } - inline const BScreen &screen() const { return m_screen; } - inline BScreen &screen() { return m_screen; } + const BScreen &screen() const { return m_screen; } + BScreen &screen() { return m_screen; } - inline const FbTk::XLayerItem &layerItem() const { return m_layeritem; } - inline FbTk::XLayerItem &layerItem() { return m_layeritem; } + const FbTk::XLayerItem &layerItem() const { return m_layeritem; } + FbTk::XLayerItem &layerItem() { return m_layeritem; } Window clientWindow() const; @@ -340,10 +349,10 @@ const std::string &title() const; const std::string &iconTitle() const; - inline int x() const { return frame().x(); } - inline int y() const { return frame().y(); } - inline unsigned int width() const { return frame().width(); } - inline unsigned int height() const { return frame().height(); } + int x() const { return frame().x(); } + int y() const { return frame().y(); } + unsigned int width() const { return frame().width(); } + unsigned int height() const { return frame().height(); } unsigned int workspaceNumber() const { return m_workspace_number; } @@ -356,8 +365,8 @@ bool isLowerTab() const; int initialState() const; - inline FbWinFrame &frame() { return m_frame; } - inline const FbWinFrame &frame() const { return m_frame; } + FbWinFrame &frame() { return m_frame; } + const FbWinFrame &frame() const { return m_frame; } /** @name signals @@ -470,7 +479,9 @@ WinClient *m_attaching_tab; BScreen &m_screen; /// screen on which this window exist - FbTk::Timer m_timer; + FbTk::Timer m_autoraise_timer; + FbTk::Timer m_autoshade_timer; + FbTk::Timer m_autounshade_timer; Display *display; /// display connection BlackboxAttributes m_blackbox_attrib; @@ -505,7 +516,7 @@ bool m_toggled_decos; struct _functions { - bool resize, move, iconify, maximize, close, tabable; + bool resize, move, iconify, maximize, close, tabable, autoshade; } functions; bool m_shaped; ///< if the window is shaped with a mask