[hyena/gtk3] CompositeUtils: Add a SetRgbaVisual method and clean up
- From: Bertrand Lorentz <blorentz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [hyena/gtk3] CompositeUtils: Add a SetRgbaVisual method and clean up
- Date: Sat, 16 Jul 2011 20:21:41 +0000 (UTC)
commit 8810ba25e8d337155efa3e81b8f190a79f557427
Author: Bertrand Lorentz <bertrand lorentz gmail com>
Date: Sat Jul 16 22:17:59 2011 +0200
CompositeUtils: Add a SetRgbaVisual method and clean up
Add SetRgbaVisual to replace SetRgbaColormap removed earlier on. Also
remove a few methods that are now available directly in gdk-sharp.
Hyena.Gui/Hyena.Gui/CompositeUtils.cs | 57 +++++----------------------------
1 files changed, 8 insertions(+), 49 deletions(-)
---
diff --git a/Hyena.Gui/Hyena.Gui/CompositeUtils.cs b/Hyena.Gui/Hyena.Gui/CompositeUtils.cs
index d757813..d7989df 100644
--- a/Hyena.Gui/Hyena.Gui/CompositeUtils.cs
+++ b/Hyena.Gui/Hyena.Gui/CompositeUtils.cs
@@ -35,29 +35,16 @@ namespace Hyena.Gui
{
public static class CompositeUtils
{
- [DllImport ("libgdk-win32-2.0-0.dll")]
- private static extern IntPtr gdk_screen_get_rgba_visual (IntPtr screen);
-
- [DllImport ("libgtk-win32-2.0-0.dll")]
- private static extern void gtk_widget_input_shape_combine_mask (IntPtr raw, IntPtr shape_mask,
- int offset_x, int offset_y);
-
- [DllImport ("libgdk-win32-2.0-0.dll")]
- private static extern IntPtr gdk_screen_get_rgba_colormap (IntPtr screen);
-
- public static Visual GetRgbaVisual (Screen screen)
+ public static bool SetRgbaVisual (Widget w)
{
- try {
- IntPtr raw_ret = gdk_screen_get_rgba_visual (screen.Handle);
- Gdk.Visual ret = GLib.Object.GetObject (raw_ret) as Gdk.Visual;
- return ret;
- } catch {
- Gdk.Visual visual = Gdk.Visual.GetBestWithDepth (32);
- if (visual != null) {
- return visual;
- }
+ Visual visual = w.Screen.RgbaVisual;
+
+ if (visual != null) {
+ w.Visual = visual;
+ return true;
}
- return null;
+
+ return false;
}
[DllImport ("libgdk-win32-2.0-0.dll")]
@@ -91,28 +78,6 @@ namespace Hyena.Gui
}
}
- [DllImport ("libgdk-win32-2.0-0.dll")]
- private static extern bool gdk_screen_is_composited (IntPtr screen);
-
- public static bool IsComposited (Screen screen)
- {
- bool composited;
- try {
- composited = gdk_screen_is_composited (screen.Handle);
- } catch (EntryPointNotFoundException) {
- Atom atom = Atom.Intern (String.Format ("_NET_WM_CM_S{0}", screen.Number), false);
- composited = Gdk.Selection.OwnerGetForDisplay (screen.Display, atom) != null;
- }
-
- // FIXME check for WINDOW_OPACITY so that we support compositing on older composite manager
- // versions before they started supporting the real check given above
- if (!composited) {
- composited = CompositeUtils.SupportsHint (screen, "_NET_WM_WINDOW_OPACITY");
- }
-
- return composited;
- }
-
public static void SetWinOpacity (Gtk.Window win, double opacity)
{
CompositeUtils.ChangeProperty (win.Window,
@@ -122,11 +87,5 @@ namespace Hyena.Gui
new uint [] { (uint) (0xffffffff * opacity) }
);
}
-
- /*public static void InputShapeCombineMask (Widget w, Pixmap shape_mask, int offset_x, int offset_y)
- {
- gtk_widget_input_shape_combine_mask (w.Handle, shape_mask == null ? IntPtr.Zero : shape_mask.Handle,
- offset_x, offset_y);
- }*/
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]