all repos — fluxbox @ 331a52115dfa5c681b065d226ee796e52b48fed0

custom fork of the fluxbox windowmanager

support for _NET_WM_MOVERESIZE
fluxgen fluxgen
commit

331a52115dfa5c681b065d226ee796e52b48fed0

parent

9699cda56e0877d361a0a79df3a8ebeea5b36f33

4 files changed, 85 insertions(+), 45 deletions(-)

jump to
M ChangeLogChangeLog

@@ -1,6 +1,8 @@

(Format: Year/Month/Day) Changes for 0.9.16: *06/06/11: + * Added support for _NET_WM_MOVERESIZE (Henrik) + Ewmh.hh/cc, Window.hh/cc * Added support for urgency hint. This make apps, that support this hint, flash the titlebar and iconbar when they want attention.
M src/Ewmh.ccsrc/Ewmh.cc

@@ -166,7 +166,7 @@ m_net_moveresize_window,

m_net_workarea, m_net_restack_window, - // m_net_wm_moveresize, + m_net_wm_moveresize, // desktop properties

@@ -672,7 +672,9 @@ void Ewmh::updateHints(FluxboxWindow &win) {

} void Ewmh::updateWorkspace(FluxboxWindow &win) { - long workspace = win.isInitialized() ? win.workspaceNumber() : win.screen().currentWorkspaceID(); + long workspace = win.isInitialized() ? + win.workspaceNumber() : + win.screen().currentWorkspaceID(); if (win.isStuck()) workspace = -1; // appear on all desktops/workspaces

@@ -713,7 +715,8 @@ // the screen is the root window of the message,

// which doesn't apply here (so borrow the variable :) ) screen = &fbwin->screen(); // valid workspace number? - if (static_cast<unsigned int>(ce.data.l[0]) < screen->numberOfWorkspaces()) + if (static_cast<unsigned int> + (ce.data.l[0]) < screen->numberOfWorkspaces()) screen->sendToWorkspace(ce.data.l[0], fbwin, false); return true;

@@ -846,8 +849,7 @@

return true; - } /* Still in progress... - else if (ce.message_type == m_net_wm_moveresize) { + } else if (ce.message_type == m_net_wm_moveresize) { if (winclient == 0 || winclient->fbwindow() == 0) return true; // data.l[0] = x_root

@@ -855,10 +857,6 @@ // data.l[1] = y_root

// data.l[2] = direction // data.l[3] = button // data.l[4] = source indication - cerr<<"("<<ce.data.l[0]<<", "<<ce.data.l[1]<<")"<<endl; - cerr<<"dir="<<ce.data.l[2]<<endl; - cerr<<"button="<<ce.data.l[3]<<endl; - cerr<<"source="<<ce.data.l[4]<<endl; switch (ce.data.l[2] ) { case _NET_WM_MOVERESIZE_SIZE_TOPLEFT: case _NET_WM_MOVERESIZE_SIZE_TOP:

@@ -883,7 +881,7 @@ break;

} return true; } - */ + // we didn't handle the ce.message_type here return false; }

@@ -929,7 +927,7 @@ m_net_close_window = XInternAtom(disp, "_NET_CLOSE_WINDOW", False);

m_net_moveresize_window = XInternAtom(disp, "_NET_MOVERESIZE_WINDOW", False); m_net_restack_window = XInternAtom(disp, "_NET_RESTACK_WINDOW", False); - // TODO: implement this one + m_net_wm_moveresize = XInternAtom(disp, "_NET_WM_MOVERESIZE", False); m_net_properties = XInternAtom(disp, "_NET_PROPERTIES", False);
M src/Window.ccsrc/Window.cc

@@ -1158,8 +1158,6 @@ if (m_labelbuttons[&client]->text() != client.title()) {

m_labelbuttons[&client]->setText(client.title()); if (&client == m_client) frame().setFocusTitle(client.title()); - - titleSig().notify(); } }

@@ -1734,7 +1732,7 @@ m_last_resize_y = new_y;

m_last_resize_w = new_w; m_last_resize_h = new_h; - ResizeCorner old_resize_corner = m_resize_corner; + ResizeDirection old_resize_corner = m_resize_corner; m_resize_corner = NOCORNER; fixsize(); m_resize_corner = old_resize_corner;

@@ -2525,6 +2523,7 @@ // update icon title and then do normal XA_WM_NAME stuff

client.updateIconTitle(); case XA_WM_NAME: updateTitleFromClient(client); + titleSig().notify(); break; case XA_WM_NORMAL_HINTS: {

@@ -2774,12 +2773,7 @@ inside_titlebar &&

!isResizing()) { if (! isMoving()) { - startMoving(me.window); - // save first event point - m_last_resize_x = me.x_root; - m_last_resize_y = me.y_root; - m_button_grab_x = me.x_root - frame().x() - frame().window().borderWidth(); - m_button_grab_y = me.y_root - frame().y() - frame().window().borderWidth(); + startMoving(me.x_root, me.y_root); } else { int dx = me.x_root - m_button_grab_x, dy = me.y_root - m_button_grab_y;

@@ -2854,22 +2848,33 @@ if (! resizing) {

int cx = frame().width() / 2; int cy = frame().height() / 2; - + ResizeDirection resize_corner = RIGHTBOTTOM; if (me.window == frame().gripRight()) - m_resize_corner = RIGHTBOTTOM; + resize_corner = RIGHTBOTTOM; else if (me.window == frame().gripLeft()) - m_resize_corner = LEFTBOTTOM; + resize_corner = LEFTBOTTOM; else if (screen().getResizeModel() != BScreen::QUADRANTRESIZE) { if (screen().getResizeModel() == BScreen::CENTERRESIZE) - m_resize_corner = ALLCORNERS; + resize_corner = ALLCORNERS; else - m_resize_corner = RIGHTBOTTOM; + resize_corner = RIGHTBOTTOM; } else if (me.x < cx) - m_resize_corner = (me.y < cy) ? LEFTTOP : LEFTBOTTOM; + resize_corner = (me.y < cy) ? LEFTTOP : LEFTBOTTOM; else - m_resize_corner = (me.y < cy) ? RIGHTTOP : RIGHTBOTTOM; + resize_corner = (me.y < cy) ? RIGHTTOP : RIGHTBOTTOM; - startResizing(me.window, me.x, me.y); + + // We are grabbing frame window in startResizing + // we need to translate coordinates to it. + int start_x = me.x, start_y = me.y; + Window child; + XTranslateCoordinates(display, + me.window, fbWindow().window(), + start_x, start_y, + &start_x, &start_y, + &child); + + startResizing(start_x, start_y, resize_corner); } else if (resizing) {

@@ -3236,9 +3241,15 @@ decorations.enabled = mask & DECORM_ENABLED;

applyDecorations(); } -void FluxboxWindow::startMoving(Window win) { +void FluxboxWindow::startMoving(int x, int y) { if (s_num_grabs > 0) return; + + // save first event point + m_last_resize_x = x; + m_last_resize_y = y; + m_button_grab_x = x - frame().x() - frame().window().borderWidth(); + m_button_grab_y = y - frame().y() - frame().window().borderWidth(); moving = true; maximized = MAX_NONE;

@@ -3498,10 +3509,12 @@

} -void FluxboxWindow::startResizing(Window win, int x, int y) { +void FluxboxWindow::startResizing(int x, int y, ResizeDirection dir) { if (s_num_grabs > 0 || isShaded() || isIconic() ) return; + + m_resize_corner = dir; resizing = true; maximized = MAX_NONE;

@@ -3511,7 +3524,8 @@ (m_resize_corner == RIGHTTOP) ? frame().theme().upperRightAngleCursor() :

(m_resize_corner == RIGHTBOTTOM) ? frame().theme().lowerRightAngleCursor() : frame().theme().lowerLeftAngleCursor(); - grabPointer(win, false, ButtonMotionMask | ButtonReleaseMask, + grabPointer(fbWindow().window(), + false, ButtonMotionMask | ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None, cursor, CurrentTime); int gx = 0, gy = 0;
M src/Window.hhsrc/Window.hh

@@ -134,13 +134,18 @@ DECORM_ENABLED = (1<<10),

DECORM_LAST = (1<<11) // useful for getting "All" }; - enum ResizeCorner { - NOCORNER, - LEFTTOP, - LEFTBOTTOM, - RIGHTBOTTOM, - RIGHTTOP, - ALLCORNERS + + enum ResizeDirection { + NOCORNER = -1, + LEFTTOP = 0, + TOP = 1, + RIGHTTOP = 2, + RIGHT = 3, + RIGHTBOTTOM = 4, + BOTTOM = 5, + LEFTBOTTOM = 6, + LEFT = 7, + ALLCORNERS = 8 }; typedef struct _blackbox_hints {

@@ -274,6 +279,26 @@ void toggleDecoration();

unsigned int decorationMask() const; void setDecorationMask(unsigned int mask); + /** + * Start moving process, grabs the pointer and draws move rectangle + * @param x position of pointer + * @param y position of pointer + */ + void startMoving(int x, int y); + /** + * Stop moving process + * @param interrupted whether the move was interrupted by hide or destroy + */ + void stopMoving(bool interrupted = false); + /** + * Starts resizing process + * @param x start position + * @param y start position + * @param dir the resize direction + */ + void startResizing(int x, int y, ResizeDirection dir); + /// stops the resizing + void stopResizing(bool interrupted = false); /** @name accessors

@@ -410,10 +435,6 @@ void shape();

void updateClientLeftWindow(); void grabButtons(); - void startMoving(Window win); - void stopMoving(bool interrupted = false); - void startResizing(Window win, int x, int y); - void stopResizing(bool interrupted = false); /// try to attach current attaching client to a window at pos x, y void attachTo(int x, int y, bool interrupted = false);

@@ -452,8 +473,13 @@

void associateClient(WinClient &client); // state and hint signals - WinSubject m_hintsig, m_statesig, m_layersig, m_workspacesig, - m_diesig, m_focussig, m_titlesig, m_attentionsig; + WinSubject m_hintsig, + m_statesig, + m_layersig, + m_workspacesig, + m_diesig, m_focussig, + m_titlesig, + m_attentionsig; class ThemeListener: public FbTk::Observer { public:

@@ -524,7 +550,7 @@ int m_old_layernum;

FbTk::FbWindow &m_parent; ///< window on which we draw move/resize rectangle (the "root window") - ResizeCorner m_resize_corner; + ResizeDirection m_resize_corner; static int s_num_grabs; ///< number of XGrabPointer's };