![]() |
ubuntu.com - launchpad.net - ubuntu help
|
|
|||||||
|
Programming Talk This forum is for all programming questions. The questions do not have to be directly related to Ubuntu and any programming language is allowed. |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Ubuntu Extra Shot
![]() Join Date: May 2006
Location: Denmark
Beans: 396
|
How do I make shaped windows?
I've been searching several hours now (again),
![]() But I haven't been able to find documentation for making shaped / non rectangular / free-form windows in Linux. I'm looking for a solution for either of these languages. C / C++ Python Lazarus Solution must be compatible with Gnome, and preferably also with Compiz fusion. Any help would be much appreciated. ![]() |
|
|
|
|
|
#2 |
|
Tall Cafè Ubuntu
![]() Join Date: Oct 2006
Beans: 2,678
Ubuntu 7.10 Gutsy Gibbon
|
Re: How do I make shaped windows?
I remember theres a way to initialize a GTK window without a frame... Maybe using that with a transparent image or something. I haven't really seen it done in Gnome though (that I can think of).
EDIT: I remember the command now: http://www.pygtk.org/docs/pygtk/clas...-set-decorated
__________________
Last edited by Wybiral; September 17th, 2007 at 02:01 PM.. |
|
|
|
|
|
#3 |
|
100% Pure Ubuntu
![]() Join Date: May 2007
Location: Paris, France
Beans: 927
Kubuntu 7.04 Feisty Fawn
|
Re: How do I make shaped windows?
What toolkit are you using?
With Qt, look at QWidget::setMask. (search term: "non rectangular" window qt) With GTK, look at gtk_widget_shape_combine_mask. (search term: "non rectangular" window gtk) Anyway, the results I found seem to detail the whole process quite correctly.
__________________
Not even tinfoil can save us now...
|
|
|
|
|
|
#4 |
|
Ubuntu Extra Shot
![]() Join Date: May 2006
Location: Denmark
Beans: 396
|
Re: How do I make shaped windows?
Thanks for nice and quick responses.
I haven't decided on a toolkit or library yet, partly because I want this specific functionality, and hoped for some examples that could help me turbo charge into some Linux GUI programming. I want compatibility with Gnome because that's what I use, and also compatibility with Compiz Fusion because I plan to use it, when functionality gets on par with Beryl. (It isn't yet IMO). I think the alpha method for Python doesn't work so well, sometimes transparent areas show the wrong background, or the background with wrong opacity when placed on a semi transparent cube with Compiz. The gtk_widget_shape_combine_mask sounds like what I want, but a google search has turned up only questions, and no examples.... Thanx for helping me on a clearly better track than where I came from. ![]() |
|
|
|
|
|
#5 |
|
Quad Shot of Ubuntu
![]() Join Date: Jan 2006
Location: Grønland,Oslo
Beans: 484
|
Re: How do I make shaped windows?
I have some shaped window (XLib XShape* + Cairo graphics on them) examples in C/C++. I just need to find them. It's late evening here so you'll get the sample(s) tomorrow.
Last edited by moma; September 17th, 2007 at 03:22 PM.. |
|
|
|
|
|
#6 | |
|
Ubuntu Extra Shot
![]() Join Date: May 2006
Location: Denmark
Beans: 396
|
Re: How do I make shaped windows?
Quote:
This Cairo thing sounds quite exciting... Do I understand correctly, that it works directly on the X frame buffer and should work with all X11 compatible window managers? If that is so, it is exactly what I want, but didn't think was possible. I'm off to read about this Cairo thingy... ![]() |
|
|
|
|
|
|
#7 | ||
|
100% Pure Ubuntu
![]() Join Date: May 2007
Location: Paris, France
Beans: 927
Kubuntu 7.04 Feisty Fawn
|
Re: How do I make shaped windows?
Quote:
http://www.brouhaha.com/~eric/software/glock/ (homepage) Quote:
__________________
Not even tinfoil can save us now...
Last edited by aks44; September 17th, 2007 at 03:45 PM.. |
||
|
|
|
|
|
#8 | |
|
Ubuntu Extra Shot
![]() Join Date: May 2006
Location: Denmark
Beans: 396
|
Re: How do I make shaped windows?
Quote:
Seems like it uses Cairo, which is vector based. Which is even better for adjusting size. It's quite late now here, so I'll have to wait till tomorrow to look at it again. Can't wait till I get home tomorrow. Oh btw, yes I probably should ditch google, I'll check out clusty for my next searches. |
|
|
|
|
|
|
#9 |
|
100% Pure Ubuntu
![]() Join Date: May 2007
Location: Paris, France
Beans: 927
Kubuntu 7.04 Feisty Fawn
|
Re: How do I make shaped windows?
Glad I could help on a subject I don't know anything about.
FWIW, for me clusty gives way better results (the relevance is not even comparable) than google for most stuff (I'd say 90/95+ % of the searches). And whenever clusty doesn't yield any relevant result, it's quite rare that google does (although it happened). The only bad side of clusty is that it really doesn't deal well with *non-english* searches IMHO.
__________________
Not even tinfoil can save us now...
Last edited by aks44; September 17th, 2007 at 05:09 PM.. |
|
|
|
|
|
#10 |
|
Quad Shot of Ubuntu
![]() Join Date: Jan 2006
Location: Grønland,Oslo
Beans: 484
|
Re: How do I make shaped windows?
Here is the sample 1.
// shape1.cpp // This simple example shows how to create a shaped, borderless window. // It uses only XLib and XShape* extension calls. The shape of the window comes from "myshape.xbm" image. myshape.xbm is readable. It also defines #define myshape_width 200 #define myshape_height 200 The code has a draw() function which tries to draw a red, filled rectangle on the face, but only pixels that hits the mask (myshape.xbm) are visible. Attached: shape1.tar You will need the "libxext-dev" package to compile and run it. Compile: $ g++ -lX11 -lXext shape1.cpp -o shape1 Run: $ ./shape1 --------- more to come. Last edited by moma; September 18th, 2007 at 08:19 AM.. |
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|