all repos — fluxbox @ 0279936d835d7d88537bcf1208035787c02ced59

custom fork of the fluxbox windowmanager

Patch from Thomas Luebking

Adds (secret) opaque resize mode. It sure would be nice if it was documented....

The relevant init file resources and their default values are:

session.screen0.opaqueResize: False
session.screen0.opaqueResizeDelay: 40
Mark Tiefenbruck mark@fluxbox.org
commit

0279936d835d7d88537bcf1208035787c02ced59

parent

43ae328658518a4ee1b3bf363f8865234c64a674

5 files changed, 56 insertions(+), 32 deletions(-)

jump to
M src/Screen.hhsrc/Screen.hh

@@ -100,6 +100,8 @@ int getWorkspaceWarpingVerticalOffset() const { return *resource.workspace_warping_vertical_offset; }

bool doAutoRaise() const { return *resource.auto_raise; } bool clickRaises() const { return *resource.click_raises; } bool doOpaqueMove() const { return *resource.opaque_move; } + bool doOpaqueResize() const { return *resource.opaque_resize; } + unsigned int opaqueResizeDelay() const { return *resource.opaque_resize_delay; } bool doFullMax() const { return *resource.full_max; } bool getMaxIgnoreIncrement() const { return *resource.max_ignore_inc; } bool getMaxDisableMove() const { return *resource.max_disable_move; }
M src/ScreenResource.ccsrc/ScreenResource.cc

@@ -83,6 +83,7 @@ ScreenResource::ScreenResource(FbTk::ResourceManager& rm,

const std::string& scrname, const std::string& altscrname): opaque_move(rm, true, scrname + ".opaqueMove", altscrname+".OpaqueMove"), + opaque_resize(rm, false, scrname + ".opaqueResize", altscrname+".OpaqueResize"), 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"),

@@ -110,6 +111,7 @@ allow_remote_actions(rm, false, scrname+".allowRemoteActions", altscrname+".AllowRemoteActions"),

clientmenu_use_pixmap(rm, true, scrname+".clientMenu.usePixmap", altscrname+".ClientMenu.UsePixmap"), tabs_use_pixmap(rm, true, scrname+".tabs.usePixmap", altscrname+".Tabs.UsePixmap"), max_over_tabs(rm, false, scrname+".tabs.maxOver", altscrname+".Tabs.MaxOver"), - default_internal_tabs(rm, true /* TODO: autoconf option? */ , scrname+".tabs.intitlebar", altscrname+".Tabs.InTitlebar") { + default_internal_tabs(rm, true /* TODO: autoconf option? */ , scrname+".tabs.intitlebar", altscrname+".Tabs.InTitlebar"), + opaque_resize_delay(rm, 50, scrname + ".opaqueResizeDelay", altscrname+".OpaqueResizeDelay") { }
M src/ScreenResource.hhsrc/ScreenResource.hh

@@ -32,6 +32,7 @@ ScreenResource(FbTk::ResourceManager &rm,

const std::string &scrname, const std::string &altscrname); FbTk::Resource<bool> opaque_move, + opaque_resize, full_max, max_ignore_inc, max_disable_move,

@@ -61,6 +62,7 @@ FbTk::Resource<bool> clientmenu_use_pixmap;

FbTk::Resource<bool> tabs_use_pixmap; FbTk::Resource<bool> max_over_tabs; FbTk::Resource<bool> default_internal_tabs; + FbTk::Resource<unsigned int> opaque_resize_delay; }; #endif
M src/Window.ccsrc/Window.cc

@@ -449,6 +449,12 @@ FbTk::RefCount<ActivateTabCmd> activate_tab_cmd(new ActivateTabCmd());

m_tabActivationTimer.setCommand(activate_tab_cmd); m_tabActivationTimer.fireOnce(true); + m_resizeTimer.setTimeout(screen().opaqueResizeDelay() * FbTk::FbTime::IN_MILLISECONDS); + FbTk::RefCount<FbTk::Command<void> > resize_cmd(new FbTk::SimpleCommand<FluxboxWindow>(*this, + &FluxboxWindow::updateResize)); + m_resizeTimer.setCommand(resize_cmd); + m_resizeTimer.fireOnce(true); + m_reposLabels_timer.setTimeout(IconButton::updateLaziness()); m_reposLabels_timer.fireOnce(true); FbTk::RefCount<FbTk::Command<void> > elrs(new FbTk::SimpleCommand<FluxboxWindow>(*this, &FluxboxWindow::emitLabelReposSig));

@@ -2663,36 +2669,36 @@ int old_resize_y = m_last_resize_y;

int old_resize_w = m_last_resize_w; int old_resize_h = m_last_resize_h; - int dx = me.x - m_button_grab_x; - int dy = me.y - m_button_grab_y; + int dx = me.x_root - m_button_grab_x; + int dy = me.y_root - m_button_grab_y; if (m_resize_corner == LEFTTOP || m_resize_corner == LEFTBOTTOM || m_resize_corner == LEFT) { - m_last_resize_w = frame().width() - dx; - m_last_resize_x = frame().x() + dx; + m_last_resize_w = resize_base_w - dx; + m_last_resize_x = resize_base_x + dx; } if (m_resize_corner == LEFTTOP || m_resize_corner == RIGHTTOP || m_resize_corner == TOP) { - m_last_resize_h = frame().height() - dy; - m_last_resize_y = frame().y() + dy; + m_last_resize_h = resize_base_h - dy; + m_last_resize_y = resize_base_y + dy; } if (m_resize_corner == LEFTBOTTOM || m_resize_corner == BOTTOM || m_resize_corner == RIGHTBOTTOM) - m_last_resize_h = frame().height() + dy; + m_last_resize_h = resize_base_h + dy; if (m_resize_corner == RIGHTBOTTOM || m_resize_corner == RIGHTTOP || m_resize_corner == RIGHT) - m_last_resize_w = frame().width() + dx; + m_last_resize_w = resize_base_w + dx; if (m_resize_corner == CENTER) { // dx or dy must be at least 2 if (abs(dx) >= 2 || abs(dy) >= 2) { // take max and make it even int diff = 2 * (max(dx, dy) / 2); - m_last_resize_h = frame().height() + diff; + m_last_resize_h = resize_base_h + diff; - m_last_resize_w = frame().width() + diff; - m_last_resize_x = frame().x() - diff/2; - m_last_resize_y = frame().y() - diff/2; + m_last_resize_w = resize_base_w + diff; + m_last_resize_x = resize_base_x - diff/2; + m_last_resize_y = resize_base_y - diff/2; } }

@@ -2780,18 +2786,23 @@ break;

} } - // draw over old rect - parent().drawRectangle(screen().rootTheme()->opGC(), - old_resize_x, old_resize_y, - old_resize_w - 1 + 2 * frame().window().borderWidth(), - old_resize_h - 1 + 2 * frame().window().borderWidth()); + if (m_last_resize_w != old_resize_w || m_last_resize_h != old_resize_h) { + if (screen().doOpaqueResize()) { + m_resizeTimer.start(); + } else { + // draw over old rect + parent().drawRectangle(screen().rootTheme()->opGC(), + old_resize_x, old_resize_y, + old_resize_w - 1 + 2 * frame().window().borderWidth(), + old_resize_h - 1 + 2 * frame().window().borderWidth()); - // draw resize rectangle - parent().drawRectangle(screen().rootTheme()->opGC(), - m_last_resize_x, m_last_resize_y, - m_last_resize_w - 1 + 2 * frame().window().borderWidth(), - m_last_resize_h - 1 + 2 * frame().window().borderWidth()); - + // draw resize rectangle + parent().drawRectangle(screen().rootTheme()->opGC(), + m_last_resize_x, m_last_resize_y, + m_last_resize_w - 1 + 2 * frame().window().borderWidth(), + m_last_resize_h - 1 + 2 * frame().window().borderWidth()); + } + } } } }

@@ -3320,29 +3331,33 @@ grabPointer(fbWindow().window(),

false, ButtonMotionMask | ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None, cursor, CurrentTime); - m_button_grab_x = x; - m_button_grab_y = y; - m_last_resize_x = frame().x(); - m_last_resize_y = frame().y(); - m_last_resize_w = frame().width(); - m_last_resize_h = frame().height(); + m_button_grab_x = x + frame().x(); + m_button_grab_y = y + frame().y(); + resize_base_x = m_last_resize_x = frame().x(); + resize_base_y = m_last_resize_y = frame().y(); + resize_base_w = m_last_resize_w = frame().width(); + resize_base_h = m_last_resize_h = frame().height(); fixSize(); frame().displaySize(m_last_resize_w, m_last_resize_h); - parent().drawRectangle(screen().rootTheme()->opGC(), + if (!screen().doOpaqueResize()) { + parent().drawRectangle(screen().rootTheme()->opGC(), m_last_resize_x, m_last_resize_y, m_last_resize_w - 1 + 2 * frame().window().borderWidth(), m_last_resize_h - 1 + 2 * frame().window().borderWidth()); + } } void FluxboxWindow::stopResizing(bool interrupted) { resizing = false; - parent().drawRectangle(screen().rootTheme()->opGC(), + if (!screen().doOpaqueResize()) { + parent().drawRectangle(screen().rootTheme()->opGC(), m_last_resize_x, m_last_resize_y, m_last_resize_w - 1 + 2 * frame().window().borderWidth(), m_last_resize_h - 1 + 2 * frame().window().borderWidth()); + } screen().hideGeometry();
M src/Window.hhsrc/Window.hh

@@ -528,6 +528,7 @@ void fixSize();

void moveResizeClient(WinClient &client); /// sends configurenotify to all clients void sendConfigureNotify(); + void updateResize() { moveResize(m_last_resize_x, m_last_resize_y, m_last_resize_w, m_last_resize_h); } static void grabPointer(Window grab_window, Bool owner_events,

@@ -553,6 +554,7 @@ uint64_t m_creation_time;

uint64_t m_last_keypress_time; FbTk::Timer m_timer; FbTk::Timer m_tabActivationTimer; + FbTk::Timer m_resizeTimer; // Window states bool moving, resizing, m_initialized;

@@ -565,6 +567,7 @@ int m_button_grab_x, m_button_grab_y; // handles last button press event for move

int m_last_resize_x, m_last_resize_y; // handles last button press event for resize int m_last_move_x, m_last_move_y; // handles last pos for non opaque moving int m_last_resize_h, m_last_resize_w; // handles height/width for resize "window" + int resize_base_x, resize_base_y, resize_base_w, resize_base_h; // opaque and transparent resize alignment int m_last_pressed_button; unsigned int m_workspace_number;