Re: window move handle widget



Andreas Volz <andreas brachttal net> wrote:

Is there a window move widget for applications which have no titlebar,
but need the ability to move around.

How could I realize this? Is it windowmanager specific?

There is a kind of that which could be used for this purpose: the
GtkHandleBox. It's meant to enable portions of a window to be detachable
and freely moveable. For this purpose it provides its own dragbar.

It's up to you to decide what a "portion" of a window is. Can be a
buttonbar, just one button, a frame or the entire window content. The
latter is what you would want. Just put a GtkHandleBox into the window at
first and then populate it with tables, hboxes, vboxes and their contents.
No further programming is required.

Program control over GtkHandleBox is very limited, however. When the
window opens the handlebox always attached to it. It can't exist
independently from its parent window. There's no clean way to force a
handlebox to detach or move it to a specified location. Furthermore, when
you detach a handlebox it's origin windows, then empty, stays on the
screen. To avoid the latter you could catch the child_detached-signal and
move the window out of sight or make it 1x1 pixels in size or both.

While it's the duty of the window manager to provide standard features to
drag windows the GtkHandleBox is independent of it and thus should work
with every WM.

Another way could be to manage the window dragging on your own by tracking
the mouse coordinates and moving the window accordingly. Drag mode could
be triggered by a "drag" button or even by just clicking somewhere in the
background of the window. AFAIK GTK doesn't provide special support for
such a feature so you'd have to program a bit more on your own. By moving
the window yourself you could of course keep track of its coordinates and
store and restore them between sessions of your program (which isn't
possible with GtkHandleBox's).

However, the much easier and more standardized way to enable window
dragging would simply be to allow it to have a WM-given dragbar    ;-)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]