[Gtk-sharp-list] Drawing into Caption

Michael Hutchinson m.j.hutchinson at gmail.com
Fri Jan 30 17:33:02 EST 2009


On Tue, Jan 6, 2009 at 6:21 PM, Michael Hutchinson
<m.j.hutchinson at gmail.com> wrote:
> On Tue, Jan 6, 2009 at 6:03 PM, Wolfgang Mauer <W.Mauer at top-soft.info> wrote:
>> Hi all,
>> is it possible to draw into the caption from a decorated window?
>
> I don't believe so, since the window decorations are drawn by the
> window manager, and there are many window managers on Linux with
> different behaviours. In the case of compiz, the decorations are drawn
> by a separate decoration process, of which there are several
> varieties.
>
> Even if you could find a way to custom-paint into the decoration,
> there would be no guarantee of the layout of existing elements within
> the decoration, as most window managers have themeable decorations.
>
> You could try hinting the window type as
> Gdk.WindowTypeHint.Splashscreen, as these don't usually have
> decorations. You'd then have to draw the caption, buttons, resize
> handles, and everything yourself. However, you might find that some
> window managers would have special behaviours associated with
> splashes, e.g. semi-transparency, which obviously wouldn't be
> desirable for a normal app.

Update: rather than hinting the window as a SplashScreen, instead
access the Window's GdkWindow. This lets you alter the decorations
elements that are drawn, and also invoke the minimise, maximise, etc.
actions.
So you could do GdkWindow.SetDecorations
(WMDecoration.Border|WMDecoration.Resizeh) and draw a full custom
window decoration at the top part of your app.

-- 
Michael Hutchinson
http://mjhutchinson.com


More information about the Gtk-sharp-list mailing list