Re: Drawing a GdkDrawable to a frame window from gdk_foreign_new ()



On Tue, Feb 16, 2010 at 10:15 AM, Sam Spilsbury <smspillaz gmail com> wrote:
Hmm, my mail client must have cut this message into two mails (bizzare bug).

In case it is actually the list doing this, here is the text of the
mail in full: http://pastebin.ca/1797937

Otherwise it is pasted below:

Hey everyone,

I'm helping to write a reparenting window manager and we are drawing
some of our decorations using GDK.

A X Window "frame" is provided to the application that draws the frame
window and from this we create a GdkWindow * with
gdk_window_foreign_new (). The colormap is set to the default colormap
for the screen.

The frame window provided to the application is the parent of a client
window for our window manager and it's parent is a "wrapper" window
between which the window manager handles. We draw directly into this
"frame" window.

From here, the decorations are drawn on to a GdkPixmap (made into a
GdkDrawable) of the same depth as the frame window. Once that is done,
that pixmap is copied on to the frame window using
gdk_window_set_back_pixmap.

Unfortunately, I must be missing something since it doesn't appear to
render correctly. I dumped the pixmap and the corresponding frame
window drawables using gdk_pixbuf_get_from_drawable and saving it
using gdk_pixbuf_save. Linked at the bottom are corresponding images
of the intended drawing on the frame window (the pixmap) and the
drawable dump of the frame window. As you might see, the frame window
is drawn in a corrupt fashion. I also tried calling gdk_window_clear
() and dumping the drawable from that, but I get a similar result.

I have also linked a pastebin to the code. Unfortunately, it's heavily
linked to the development version of compiz, so you may need to
compile that should you need to test it. The drawing happens in void
draw_window_decoration (). The decoration size is calculated in
calc_window_decoration_size (). We take the frame window and create a
GdkWindow from it in add_frame_window ().

Ack, just realized I accidentally sent to gtk-devel and not
gtk-app-devel - apologies, I have cc'd the app-devel list

Sorry for bothering you!

Regards,

Sam


Any pointers of what I might be doing wrong here would be great!

Kind Regards,

Sam

[Intended window background] http://imgur.com/88W7x
[Actual drawable dump of the window background] http://imgur.com/K44ed
[Pastebin of the code, to where you should replace
/gtk/window-decorator/gtk-window-decorator.c in the compiz/core
section should you choose to test it] http://pastebin.ca/1797929

On Tue, Feb 16, 2010 at 10:11 AM, Sam Spilsbury <smspillaz gmail com> wrote:
Hey everyone,

I'm helping to write a reparenting window manager and we are drawing
some of our decorations using GDK.

A X Window "frame" is provided to the application that draws the frame
window and from this we create a GdkWindow * with
gdk_window_foreign_new (). The colormap is set to the default colormap
for the screen.

The frame window provided to the application is the parent of a client
window for our window manager and it's parent is a "wrapper" window
between which the window manager handles. We draw directly into this
"frame" window.

From here, the decorations are drawn on to a GdkPixmap (made into a
GdkDrawable) of the same depth as the frame window. Once that is done,
that pixmap is copied on to the frame window using
gdk_window_set_back_pixmap.

Unfortunately, I must be missing something since it doesn't appear to
render correctly. I dumped the pixmap and the corresponding frame
window drawables using gdk_pixbuf_get_from_drawable and saving it
using gdk_pixbuf_save. Linked at the bottom are corresponding images
of the intended drawing on the frame window (the pixmap) and the
drawable dump of the frame window. As you might see, the frame window
is drawn in a corrupt fashion. I also tried calling gdk_window_clear
() and dumping the drawable from that, but I get a similar result.

I have also linked a pastebin to the code. Unfortunately, it's heavily
linked to the development version of compiz, so you may need to
compile that should you need to test it. The drawing happens in void
draw_window_decoration (). The decoration size is calculated in
calc_window_decoration_size (). We take the frame window and create a
GdkWindow from it in add_frame_window ().

Any pointers of what I might be doing wrong here would be great!

Kind Regards,

Sam

[Intended window background] http://imgur.com/88W7x
[Actual drawable dump of the window background] http://imgur.com/K44ed
[Pastebin of the code, to where you should replace
/gtk/window-decorator/gtk-window-decorator.c in the compiz/core
section should you choose to test it] http://pastebin.ca/1797929

--
Sam Spilsbury




--
Sam Spilsbury




-- 
Sam Spilsbury



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