reassign 551807 openbox
thanks

Hi,

Nico Golde a écrit :
> * Pini <gilles.filipp...@free.fr> [2009-10-21 12:59]:
>> I use xfce4 + openbox + matchbox-keyboard on an Openmoko FreeRunner[0].
>> xfce4 is configured with 1 bottom xfce4-panel.
>>
>> All applications are xy-maximized using this configuration snippet in
>> ..config/openbox/rc.xml:
>>
>>   <application class="*">
>>     <decor>no</decor>
>>     <maximized>true</maximized>
>>   </application>
>>
>> With either xfce4-panel[1] or matchbox-keyboard[2] displayed, the
>> xy-maximization is fine.
>>
>> When both are displayed the xy-maximized windows are too high. See [3]:
>> the dialog's buttons are hidden behind the matchbox-keyboard.
>>
>> I guess this is an openbox bug since windows' sizes are ok with other
>> window managers - e.g. matchbox.
> 
> I am reassigning this and #550221 to matchbox keyboard now. I don't know this 
> tool nor do I have the time to invest its x properties but it seems all 
> unexpected behaviour recently involves this tool. I see no wrong behaviour in
> how openbox is handling ICCCM and EWMH compliance.

I've done some testing around this bug and set up a simple testcase to
reproduce it (attached).

AFAIUI, all lies in how STRUTs are handled by the window manager. IMO
they should be cumulative: when win1, win2, ..., winN set STRUTs, the
resulting workarea should be cropped by STRUT1 + STRUT2 + ... + STRUTN.

The testcase demonstrates that openbox currently crops the workarea with
max(STRUT1, STRUT2, ..., STRUTN) instead of their sum. This way is wrong
- IMHO - since only one STRUT can be set at once per display side then.
Moreover, setting - say - a right STRUT + a bottom STRUT results in an
overlapping in the workarea's bottom right corner.

=> Reassigning to openbox.

To reproduce:
$ gcc -lX11 -c testcase.c -o testcase
$ ./testcase &
$ ./testcase &
...

Each testcase instance defines a bottom STRUT of 1/3 of the current
workarea.

Hope this helps,

_Gilles.

#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xresource.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <X11/Xatom.h>

static int
get_workspace_area(Display *dpy, int *x, int *y, int *width, int *height)
{
  Atom           atom_area, type;
  int            result, format;
  unsigned long  nitems, bytes_after;
  int           *geometry = NULL;
  int            try;

  atom_area = XInternAtom (dpy, "_NET_WORKAREA", False);

  result = XGetWindowProperty (dpy,
           DefaultRootWindow(dpy),
           atom_area,
           0, 16L, False, XA_CARDINAL, &type, &format,
           &nitems, &bytes_after,
           (unsigned char **)&geometry);

  if (x) *x           = geometry[0];
  if (y) *y           = geometry[1];
  if (width)  *width  = geometry[2];
  if (height) *height = geometry[3];
  XFree(geometry);

  return 1;
}

static Window
window_create(Display *dpy, int * width, int * height)
{
  Window win;

  unsigned long background = BlackPixel(dpy, DefaultScreen(dpy));

  Atom /* atom_wm_protocols[3], */ 
     atom_NET_WM_WINDOW_TYPE, 
     atom_NET_WM_WINDOW_TYPE_DOCK,
     atom_NET_WM_STRUT;

  XSizeHints           size_hints;
  XSetWindowAttributes win_attr;

  int win_coord_x, win_coord_y;
  int  desk_width = 0, desk_height = 0, desk_x = 0, desk_y = 0;
  
  atom_NET_WM_WINDOW_TYPE =
    XInternAtom(dpy, "_NET_WM_WINDOW_TYPE" , False);

  atom_NET_WM_WINDOW_TYPE_DOCK = 
    XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DOCK", False);

  atom_NET_WM_STRUT = 
    XInternAtom(dpy, "_NET_WM_STRUT", False);

  win_attr.event_mask 
    = ButtonPressMask|StructureNotifyMask|ExposureMask;

  get_workspace_area(dpy, &desk_x, &desk_y, &desk_width, &desk_height);
  *width = desk_width;
  *height = desk_height / 3;
  win_coord_x = desk_x;
  win_coord_y = desk_y + desk_height - *height;

  win = XCreateWindow(dpy,
    DefaultRootWindow(dpy),
    win_coord_x, win_coord_y,
    *width, *height,
    0,
    CopyFromParent, CopyFromParent, CopyFromParent,
    CWEventMask,
    &win_attr);

  XSetWindowBackground(dpy, win, background);

  size_hints.flags = PPosition;
  size_hints.x = 0;
  size_hints.y = 0;
    
  XSetStandardProperties(dpy, win, "Test", 
			 NULL, 0, NULL, 0, &size_hints);
  /* STRUTS */
  int wm_struct_vals[] = { 0, /* left */			
    0, /* right */ 
    0, /* top */
    *height, /* bottom */
  };
	      
  XChangeProperty(dpy, win, 
    atom_NET_WM_STRUT, XA_CARDINAL, 32, 
    PropModeReplace, 
    (unsigned char *)wm_struct_vals , 4);
	      
  XChangeProperty(dpy, win,
    atom_NET_WM_WINDOW_TYPE, XA_ATOM, 32,
    PropModeReplace,
    (unsigned char *) &atom_NET_WM_WINDOW_TYPE_DOCK, 1);

  return win;
}

int main(int argc, char ** argv){
  int screen_num, width, height;
  Window win;
  XEvent ev;
  Display *dpy;
  GC pen;
  XGCValues values;

  dpy = XOpenDisplay(NULL);
  if (!dpy) {fprintf(stderr, "unable to connect to display\n");return 7;}

  screen_num = DefaultScreen(dpy);

  win = window_create(dpy, &width, &height);
  printf("Size changed to: %d by %d\n", width, height);

  values.foreground = WhitePixel(dpy, screen_num);
  values.line_width = 1;
  values.line_style = LineSolid;
  pen = XCreateGC(dpy, win, GCForeground|GCLineWidth|GCLineStyle,&values);

  XMapWindow(dpy, win);

  while(1){
    XWindowEvent(dpy, win, StructureNotifyMask|ButtonPressMask|ExposureMask, &ev);
    switch(ev.type){
      case Expose:
        XDrawLine(dpy, win, pen, 0, 0, width-1, height-1);
        XDrawLine(dpy, win, pen, width-1, 0, 0, height-1);
        XDrawRectangle(dpy, win, pen, 0, 0, width-1, height-1);
        break;
      case ConfigureNotify:
        if (width != ev.xconfigure.width || height != ev.xconfigure.height) {
          width = ev.xconfigure.width;
          height = ev.xconfigure.height;
          XClearWindow(dpy, ev.xany.window);
          printf("Size changed to: %d by %d\n", width, height);
        }
        break;
      case ButtonPress:
        XCloseDisplay(dpy);
        return 0;
    }
  }
}

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to