From cb3f9ed28a1f6972c83d116aa5e9c7f93f2d742a Mon Sep 17 00:00:00 2001 From: markt Date: Sun, 20 May 2007 21:45:51 +0000 Subject: added session.screen.maxDisableMove/Resize, plus some other cleanup --- ChangeLog | 3 +++ nls/fluxbox-nls.hh | 2 ++ src/FocusControl.cc | 6 ++---- src/Screen.cc | 24 ++++++++---------------- src/Screen.hh | 7 +++++-- src/Window.cc | 8 +++++++- src/Workspace.cc | 9 --------- 7 files changed, 27 insertions(+), 32 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9f6f4b6..a5ec168 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,9 @@ (Format: Year/Month/Day) Changes for 1.1: *07/05/20: + * Added resources session.screen.maxDisable{Move,Resize}: , which + prevent maximized windows from being moved/resized (Mark) + Window.cc Screen.cc/hh nls/fluxbox-nls.hh * Fixed bug #1717782, Bad fullscreen in ooimpress2 ( Henrik ) mwm hint had no-resize which made resizing with FluxboxWindow::setFullscreen impossible. diff --git a/nls/fluxbox-nls.hh b/nls/fluxbox-nls.hh index 95c537b..6ad46c6 100644 --- a/nls/fluxbox-nls.hh +++ b/nls/fluxbox-nls.hh @@ -79,6 +79,8 @@ enum { ConfigmenuClickTabFocus = 25, ConfigmenuMaxMenu = 26, ConfigmenuMaxIgnoreInc = 27, + ConfigmenuMaxDisableMove = 28, + ConfigmenuMaxDisableResize = 29, EwmhSet = 5, EwmhOutOfMemoryClientList = 1, diff --git a/src/FocusControl.cc b/src/FocusControl.cc index 11ee0a7..126f8b1 100644 --- a/src/FocusControl.cc +++ b/src/FocusControl.cc @@ -274,7 +274,7 @@ void FocusControl::stopCyclingFocus() { * is given. */ Focusable *FocusControl::lastFocusedWindow(int workspace) { - if (m_focused_list.empty()) return 0; + if (m_focused_list.empty() || m_screen.isShuttingdown()) return 0; if (workspace < 0 || workspace >= (int) m_screen.numberOfWorkspaces()) return m_focused_list.front(); @@ -472,8 +472,6 @@ void FocusControl::shutdown() { Focusables::reverse_iterator it = m_focused_list.rbegin(); for (; it != m_focused_list.rend(); ++it) { WinClient *client = dynamic_cast(*it); -if (client) -std::cerr << "FocusControl::shutdown: " << client->title() << std::endl; if (client && client->fbwindow()) client->fbwindow()->restore(client, true); } @@ -484,7 +482,7 @@ std::cerr << "FocusControl::shutdown: " << client->title() << std::endl; * focus is meant to be, it'll make things right ;-) */ void FocusControl::revertFocus(BScreen &screen) { - if (s_reverting) + if (s_reverting || screen.isShuttingdown()) return; FocusControl::s_reverting = true; diff --git a/src/Screen.cc b/src/Screen.cc index 7f44e42..915c055 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -283,6 +283,8 @@ BScreen::ScreenResource::ScreenResource(FbTk::ResourceManager &rm, opaque_move(rm, false, scrname + ".opaqueMove", altscrname+".OpaqueMove"), full_max(rm, false, scrname+".fullMaximization", altscrname+".FullMaximization"), max_ignore_inc(rm, true, scrname+".maxIgnoreIncrement", altscrname+".MaxIgnoreIncrement"), + max_disable_move(rm, false, scrname+".maxDisableMove", altscrname+".MaxDisableMove"), + max_disable_resize(rm, false, scrname+".maxDisableResize", altscrname+".MaxDisableResize"), workspace_warping(rm, true, scrname+".workspacewarping", altscrname+".WorkspaceWarping"), show_window_pos(rm, true, scrname+".showwindowposition", altscrname+".ShowWindowPosition"), auto_raise(rm, true, scrname+".autoRaise", altscrname+".AutoRaise"), @@ -1350,17 +1352,11 @@ void BScreen::updateNetizenWindowFocus() { void BScreen::updateNetizenWindowAdd(Window w, unsigned long p) { - - // update the list of clients - m_clientlist_sig.notify(); - - // and then send the signal to listeners Netizens::iterator it = m_netizen_list.begin(); Netizens::iterator it_end = m_netizen_list.end(); for (; it != it_end; ++it) { (*it)->sendWindowAdd(w, p); } - } @@ -1368,8 +1364,6 @@ void BScreen::updateNetizenWindowDel(Window w) { for_each(m_netizen_list.begin(), m_netizen_list.end(), bind2nd(mem_fun(&Netizen::sendWindowDel), w)); - - m_clientlist_sig.notify(); } @@ -1638,20 +1632,12 @@ void BScreen::reassociateWindow(FluxboxWindow *w, unsigned int wkspc_id, if (w->isIconic()) { removeIcon(w); getWorkspace(wkspc_id)->addWindow(*w); - // client list need to notify now even though - // we didn't remove/add any window, - // so listeners that uses the client list to - // show whats on current/other workspace - // gets updated - m_clientlist_sig.notify(); } else if (ignore_sticky || ! w->isStuck()) { // fresh windows have workspaceNumber == -1, which leads to // an invalid workspace (unsigned int) if (getWorkspace(w->workspaceNumber())) getWorkspace(w->workspaceNumber())->removeWindow(w, true); getWorkspace(wkspc_id)->addWindow(*w); - // see comment above - m_clientlist_sig.notify(); } } @@ -1808,6 +1794,12 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) { "Ignore Resize Increment", "Maximizing Ignores Resize Increment (e.g. xterm)", *resource.max_ignore_inc, saverc_cmd); + _BOOLITEM(*maxmenu, Configmenu, MaxDisableMove, + "Disable Moving", "Don't Allow Moving While Maximized", + *resource.max_disable_move, saverc_cmd); + _BOOLITEM(*maxmenu, Configmenu, MaxDisableResize, + "Disable Resizing", "Don't Allow Resizing While Maximized", + *resource.max_disable_resize, saverc_cmd); maxmenu->updateMenu(); menu.insert(maxmenu_label, maxmenu); diff --git a/src/Screen.hh b/src/Screen.hh index eb67067..602d5b9 100644 --- a/src/Screen.hh +++ b/src/Screen.hh @@ -124,6 +124,8 @@ public: bool doOpaqueMove() const { return *resource.opaque_move; } bool doFullMax() const { return *resource.full_max; } bool getMaxIgnoreIncrement() const { return *resource.max_ignore_inc; } + bool getMaxDisableMove() const { return *resource.max_disable_move; } + bool getMaxDisableResize() const { return *resource.max_disable_resize; } bool doShowWindowPos() const { return *resource.show_window_pos; } bool decorateTransient() const { return *resource.decorate_transient; } const std::string &defaultDeco() const { return *resource.default_deco; } @@ -562,8 +564,9 @@ private: const std::string &altscrname); FbTk::Resource image_dither, opaque_move, full_max, - max_ignore_inc, workspace_warping, show_window_pos, - auto_raise, click_raises, decorate_transient; + max_ignore_inc, max_disable_move, max_disable_resize, + workspace_warping, show_window_pos, auto_raise, click_raises, + decorate_transient; FbTk::Resource default_deco; FbTk::Resource rootcommand; FbTk::Resource resize_model; diff --git a/src/Window.cc b/src/Window.cc index 3042812..0d8b9e5 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -1842,7 +1842,7 @@ void FluxboxWindow::stick() { stuck = !stuck; if (m_initialized) { - setState(m_current_state, false); + stateSig().notify(); // notify since some things consider "stuck" to be a pseudo-workspace m_workspacesig.notify(); } @@ -3233,6 +3233,9 @@ void FluxboxWindow::startMoving(int x, int y) { if (s_num_grabs > 0) return; + if (isMaximized() && screen().getMaxDisableMove()) + return; + // save first event point m_last_resize_x = x; m_last_resize_y = y; @@ -3503,6 +3506,9 @@ void FluxboxWindow::startResizing(int x, int y, ResizeDirection dir) { if (s_num_grabs > 0 || isShaded() || isIconic() ) return; + if (isMaximized() && screen().getMaxDisableResize()) + return; + m_resize_corner = dir; resizing = true; diff --git a/src/Workspace.cc b/src/Workspace.cc index 05d8420..1a4aa06 100644 --- a/src/Workspace.cc +++ b/src/Workspace.cc @@ -124,15 +124,6 @@ int Workspace::removeWindow(FluxboxWindow *w, bool still_alive) { m_windowlist.remove(w); m_clientlist_sig.notify(); - if (!w->isStuck()) { - FluxboxWindow::ClientList::iterator client_it = - w->clientList().begin(); - FluxboxWindow::ClientList::iterator client_it_end = - w->clientList().end(); - for (; client_it != client_it_end; ++client_it) - screen().updateNetizenWindowDel((*client_it)->window()); - } - return m_windowlist.size(); } -- cgit v0.11.2