Re: Gtk Window Screen Boundaries



I was able to solve this problem.

Sample Code:

#import <gtk/gtk.h>
#import <gdk/gdk.h>
#import <gdk/gdkx.h>
#import <X11/Xlib.h>
#import <X11/Xatom.h>

+ (void)reserveLeftWidth:(guint32)leftWidth
                           leftStart:(guint32)leftStart
                                 leftEnd:(guint32)leftEnd
                          rightWidth:(guint32)rightWidth
                          rightStart:(guint32)rightStart
                                rightEnd:(guint32)rightEnd
                           topHeight:(guint32)topHeight
                                topStart:(guint32)topStart
                                  topEnd:(guint32)topEnd
                        bottomHeight:(guint32)bottomHeight
                         bottomStart:(guint32)bottomStart
                           bottomEnd:(guint32)bottomEnd
                                maWindow:(MAWindow *)maWindow
{
        static Atom net_wm_strut = 0;
        static Atom net_wm_strut_partial = 0;
        GtkWindow * gtkWindow = NULL;
        GdkWindow * gdkWindow = NULL;
        Display * display = NULL;
        Window window = 0;
        gulong struts[12];
        bzero(&struts,sizeof(struts));
        
        gtkWindow = GTK_WINDOW([maWindow widget]);
        assert(NULL != gtkWindow);
        
        gdkWindow = GTK_WIDGET(gtkWindow)->window;
        assert(NULL != gdkWindow);
        assert(GDK_IS_DRAWABLE(gdkWindow));
        assert(GDK_IS_WINDOW(gdkWindow));
        
        display = GDK_WINDOW_XDISPLAY(gdkWindow);
        window = GDK_WINDOW_XWINDOW(gdkWindow);
        
if (net_wm_strut == 0) net_wm_strut = XInternAtom(display, "_NET_WM_STRUT", False); if (net_wm_strut_partial == 0) net_wm_strut_partial = XInternAtom(display, "_NET_WM_STRUT_PARTIAL", False);
        
        struts[kXStrutTop] = topHeight;
        struts[kXStrutTopStart] = topStart;
        struts[kXStrutTopEnd] = topEnd;
        
        struts[kXStrutBottom] = bottomHeight;
        struts[kXStrutBottomStart] = bottomStart;
        struts[kXStrutBottomEnd] = bottomEnd;
        
        struts[kXStrutLeft] = leftWidth;
        struts[kXStrutLeftStart] = leftStart;
        struts[kXStrutLeftEnd] = leftEnd;
        
        struts[kXStrutRight] = rightWidth;
        struts[kXStrutRightStart] = rightStart;
        struts[kXStrutRightEnd] = rightEnd;
        
        gdk_error_trap_push();
        {
XChangeProperty(display, window, net_wm_strut, XA_CARDINAL, 32, PropModeReplace, (guchar *)&struts, 4); XChangeProperty (display, window, net_wm_strut_partial, XA_CARDINAL, 32, PropModeReplace, (guchar *)&struts, 12);
        }
        gdk_error_trap_pop();
}


On 11-Oct-08, at 10:49 AM, Dan Saul wrote:

Hi Gtk Application Development,

I am developing a program that is akin to a Dock, is there a way to
tell gtk or the xwindow system not to place windows within certain
rects (also maximize limits) so that windows do not spawn underneath
the windows? I have set the window type hint to Dock but to no avail.

If this information is readily available on the internet I have been
not been able to find it using search engines.

If someone could point me in the right direction it would be much appreciated,
Thanks
Dan




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