LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 06-26-2004, 05:32 AM   #1
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: ubuntu
Posts: 2,530

Rep: Reputation: 108Reputation: 108
How to get rid of decorations from window manager?


How can I prevent an X program to have decorations from the window manager like e.g. "xeyes", "xmms" and "gkrellm" do?

I use the metacity window manager and gnome (at the moment). Metacity seems to honour the no-decorations request from GTK-apps, but not from "xeyes". Under e.g. "IceWM" xeyes works correctly and doesn't have these decorations. I suppose the reason for this is that xeyes uses the low-level xlibs to do this, and "metacity" doesn't seem to support this.

But obviously GTK needs to use the xlibs to do the same thing. Then how can it be possible GTK programs can get rid of the decorations under metacity, but progs like xeyes don't?

Here's why this long introduction: I like "buici-clock" (ftp://ftp.buici.com/pub/buici-clock/) very much. This is a nice looking, round, analog clock and it uses the the shape extension, so its client-window part is transparant. But it does have windows-decorations (title-bar and frame), even under IceWM (where xeyes works correctly without them).

Now I'd like to try to patch this thing so it doesn't have the decorations, preferably also with metacity. The problem will probably be that this "buici-clock" does not use any toolkit, so chances are it's not going to work under metacity. Is suppose this should be possible though, as GTK seems to manage...

So I'd need to do this through the xlibs, and I have no experience whatsoever with the xlibs. (but I'm willing to dig into it). Another option could be to make a similar app fromm scratch using GTK. But how to do this with GTK? I tried to find out browsing through the sources of xmms, ony to find out it was beyond my skills to understand what's happening in xmms' sources....

Does anyone have some useful information about this? Or what is the keyword to google for? I tried searching through the GTK-docs for the "decoration" and "window manager", which was not of much help.

Thanks in advance.

Last edited by Hko; 06-26-2004 at 05:34 AM.
 
Old 06-26-2004, 09:28 PM   #2
arvind_sv
Member
 
Registered: Oct 2002
Location: Bangalore
Distribution: Gentoo Linux
Posts: 96

Rep: Reputation: 15
If you use gtk+-2.0, you can include gtkwindow.h and use gtk_window_set_decorated and set the second arg to FALSE. Compile the following program with:
gcc `pkg-config --cflags --libs gtk+-2.0` nodecor.c -o nodecor

Code:
#include <stdio.h>
#include <stdlib.h>

#include <gtk/gtk.h>
#include <gtk/gtkwindow.h>

int main (int argc, char **argv)
{
    GtkWidget *window = NULL;
    GtkWidget *button = NULL;

    gtk_init (&argc, &argv);

    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

    /* No decorations. */
    gtk_window_set_decorated (GTK_WINDOW (window), FALSE);

    button = gtk_button_new_with_label ("Button 1");
    gtk_container_add (GTK_CONTAINER (window), button);
    gtk_widget_show (button);

    /* Show the window */
    gtk_widget_show (window);

    gtk_main ();

    return (0);
}
Arvind
 
Old 06-27-2004, 08:27 AM   #3
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: ubuntu
Posts: 2,530

Original Poster
Rep: Reputation: 108Reputation: 108
That works perfectly. Even with metacity.
Thank you.

If somebody has info on how to do this with the raw xlibs, I remain interested.
 
Old 06-27-2004, 09:13 AM   #4
arvind_sv
Member
 
Registered: Oct 2002
Location: Bangalore
Distribution: Gentoo Linux
Posts: 96

Rep: Reputation: 15
Er, no. The "raw xlibs" do not draw the decorations. They're called "window manager decorations" for a reason. They're drawn by the window manager. So, GTK and QT have directions to the window manager, telling them whether or not to draw the decorations.

I'd be surprised if someone comes up with some low level X API function to do this. I don't think it's even possible.

Arvind
 
Old 06-27-2004, 09:29 AM   #5
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: ubuntu
Posts: 2,530

Original Poster
Rep: Reputation: 108Reputation: 108
I think the window manager "asks" the xlibs, or the xlibs pass the request for decorations or not fotr every app running on the X-server.

I think i must be possible: The "xeyes" programs, which uses no toolkit and only th raw xlibs, manages to be displayed in a window without decorations from the window manager. Well, not for the metacity windows manager, but it does work under most, like fvwm, icewm...

Last edited by Hko; 06-27-2004 at 09:31 AM.
 
Old 06-27-2004, 10:31 AM   #6
arvind_sv
Member
 
Registered: Oct 2002
Location: Bangalore
Distribution: Gentoo Linux
Posts: 96

Rep: Reputation: 15
Hmm, yes. That makes sense. But, we're both sort of right. Maybe what you're looking for is:

http://www.motifdeveloper.com/tips/tip7.html
http://www.motifdeveloper.com/tips/tip30.html

Again, AFAIK, Motif is a toolkit too. Probably xeyes uses this. I doubt it uses pure Xlib. It'd be hell to write it in pure Xlib, I think (don't know ANYTHING about Xlib). I still stick by what I said. I don't believe that Xlib is supposed to even care about something called "decorations". It seems to be at a much lower level than that.

Arvind
 
Old 06-27-2004, 11:27 AM   #7
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: ubuntu
Posts: 2,530

Original Poster
Rep: Reputation: 108Reputation: 108
Yes, Motif is a toolkit too, but xeyes does not use it AFAICS. Xeyes is distributed as part of XFree86. I browsed through the sources, and I could not find any reference to any toolkit. Also:
Code:
heiko@hko:~$ ldd `which xeyes`
                libXmu.so.6 => /usr/X11R6/lib/libXmu.so.6 (0x40030000)
        libXt.so.6 => /usr/X11R6/lib/libXt.so.6 (0x40046000)
        libSM.so.6 => /usr/X11R6/lib/libSM.so.6 (0x40098000)
        libICE.so.6 => /usr/X11R6/lib/libICE.so.6 (0x400a1000)
        libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x400b8000)
        libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x400c6000)
        libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0x4018d000)
        libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0x401b0000)
        libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0x402eb000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
This does not refer to any toolkit either.

(BTW Motif is a commercial toolkit AFAIK, LessTif is the OpenSource clone of it)

I still think the no-decoration-stuff is inside the xlibs. Because if it was managed by a certain toolkit, the app requesting not to be decorated would need always to use the same toolkit as the window manager. I could be mistaken about this though.

Another thought I had was that maybe xlibs don't handle the decorations or not, but because xeyes uses the shape-extension, some window managers would choose to not put decorations on apps using shape extensions. But this can be true either, because buici-clock uses the shape extension for sure, but it has decorations with IceWM, while xeyes has not.

Last edited by Hko; 06-27-2004 at 11:29 AM.
 
Old 06-27-2004, 02:41 PM   #8
SciYro
Senior Member
 
Registered: Oct 2003
Location: hopefully not here
Distribution: Gentoo
Posts: 2,038

Rep: Reputation: 51
when you create a window, set the "override_redirect" flag, this tells the X server that the window's stuff should not be manipulated by other programs running on the server

heres a link for Xlib programing (yea, long, iv spent the last month or 2 reading it, but I'm the slowest reader ever! )

http://www.ac3.edu.au/SGI_Developer/...b_PG/sgi_html/

chapter 4 is what you want to look at (also might wanna read thru chapters 2-3 for some additional info on working with Xlib if you are really interested

edit: the Xlibs dont decorate, but the X server allows borders of a solid color, or a piximap (the WM's usually destroy borders)

Last edited by SciYro; 06-27-2004 at 02:42 PM.
 
Old 06-27-2004, 04:03 PM   #9
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: ubuntu
Posts: 2,530

Original Poster
Rep: Reputation: 108Reputation: 108
Thank you very much as well!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Kpager with no window decorations thunder3000 Linux - Newbie 10 10-22-2004 06:23 PM
No window decorations iasion Linux - Software 3 03-25-2004 04:41 AM
Window decorations gone iasion Linux - Newbie 0 03-17-2004 06:03 AM
Installing Window Decorations niteshadw Linux - General 0 08-29-2003 08:55 PM
Window Decorations in GNOME 2 keating_5 Linux - Software 0 10-04-2002 07:04 PM


All times are GMT -5. The time now is 09:15 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration