List Info

Thread: Superswitcher 0.3 and libwnck




Superswitcher 0.3 and libwnck
user name
2006-04-17 13:44:51
Not finding a libwnck-devel-list, I'm asking
metacity-devel-list.

Superswitcher [1] is built on top of libwnck.  For example,
it allows
one to "delete" a workspace, so that if I had
six windows A, B, C, D,
E and F in four workspaces like

Workspace 1: A, B, C
Workspace 2: [empty]
Workspace 3: D
Workspace 4: E, F

then "deleting" workspace 2 would result in

Workspace 1: A, B, C
Workspace 2: D
Workspace 3: E, F

Currently, this is implemented somewhat hackily by first
moving
windows D, E and F to their respective new workspaces, and
then
setting the number of workspaces to 3.  This is not atomic,
however,
which might lead to subtle bugs.

My first question is - if I converted my application code to
a libwnck
patch (that declares new API), would the libwnck maintainers
be
interested at all in this?

My second question is - in order to move windows from one
Xinerama
screen to the next, I have to find out the x/y/width/height
of
metacity's framing window (sorry but I don't know the
right name to
call it - the surrounding window that the window manager
adds that has
e.g. the titlebar), but libwnck doesn't give me that, since
my
understanding is that libwnck is window-manager agnostic.

Right now, I am doing the chunk of code below (from
superswitcher/src/xinerama.c), but it seems rather hacky and
fragile,
and I am asking if there is a better way to do this.

-----------------------------------------------
static Window get_x_parent_window (Display *x_display,
Window x_window)
{
  Window root, parent;
  Window *children;
  unsigned int num_children;

  XQueryTree (x_display, x_window, &root, &parent,
&children, &num_children);
  XFree (children);
  return parent;
}

void ss_xinerama_move_to_next_screen (SSXinerama *xinerama,
SSWindow *window)
{
...
  // libwnck doesn't have a set_geometry function, nor does
it give the
  // geometry of the window manager's frame, so we do this
with X calls.
  x_window = wnck_window_get_xid (window->wnck_window);
  x_parent_window = get_x_parent_window
(xinerama->x_display, x_window);
  XGetGeometry (xinerama->x_display, x_parent_window,
    &root, &x, &y, &width, &height,
&border_width, &depth);

  // now move to the next screen.
  xs = &xinerama->screens[best_screen];
  dx = x - xs->x;
  dy = y - xs->y;
  best_screen = (best_screen + 1) %
xinerama->num_screens;
  xs = &xinerama->screens[best_screen];

  // Yuck.  So, I move the window to the desired x,y of its
PARENT window on
  // the other (Xinerama) screen.  This seems unintuitive,
but it's what works
  // with metacity.  This may be totally broken on other
window managers.
  XMoveWindow (xinerama->x_display, x_window, xs->x +
dx, xs->y + dy);
}
-----------------------------------------------

thanks,
Nigel.

[1] http:/
/www.gnomefiles.org/app.php?soft_id=1231
_______________________________________________
metacity-devel-list mailing list
metacity-devel-listgnome.org
http://mail.gnome.org/mailman/listinfo/metacity-devel-
list
Superswitcher 0.3 and libwnck
user name
2006-04-19 01:20:43
On 4/17/06, Nigel Tao <nigel.taomyrealbox.com> wrote:

(I probably should have responded off list after seeing this
in the
moderation queue, but oh well...)

> Currently, this is implemented somewhat hackily by
first moving
> windows D, E and F to their respective new workspaces,
and then
> setting the number of workspaces to 3.  This is not
atomic, however,
> which might lead to subtle bugs.
>
> My first question is - if I converted my application
code to a libwnck
> patch (that declares new API), would the libwnck
maintainers be
> interested at all in this?

I don't think you can make it atomic in libwnck either, as
libwnck has
to send a bunch of separate messages to the window manager
(who does
the real work of actually moving the windows and changing
the number
of workspaces).  You'd need to probably get an extension
into the EWMH
on wm-spec-list.  And then, if everyone thought it was
worthwhile
enough to include, wait for all the relevant window managers
to
implement it...

> My second question is - in order to move windows from
one Xinerama
> screen to the next, I have to find out the
x/y/width/height of
> metacity's framing window (sorry but I don't know the
right name to
> call it - the surrounding window that the window
manager adds that has
> e.g. the titlebar), but libwnck doesn't give me that,
since my
> understanding is that libwnck is window-manager
agnostic.

libwnck is supposed to be, but it turns out to be irrelevant
in this
case.  There's already a _NET_FRAME_EXTENTS property which
provides
this information (try running 'xprop' and then clicking on
some
window; then look for this and other properties).  It looks
like
libwnck doesn't monitor this, but you could always get the
property
yourself.

Also, I don't see why you need that information.  At most,
you should
only need to specify a different gravity.
_______________________________________________
metacity-devel-list mailing list
metacity-devel-listgnome.org
http://mail.gnome.org/mailman/listinfo/metacity-devel-
list
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )