~ubuntu-branches/debian/squeeze/f-spot/squeeze

« back to all changes in this revision

Viewing changes to src/Utils/GdkUtils.cs

  • Committer: Bazaar Package Importer
  • Author(s): Iain Lane, Mirco Bauer, Iain Lane
  • Date: 2009-02-07 20:23:32 UTC
  • mfrom: (1.1.18 upstream)
  • Revision ID: james.westby@ubuntu.com-20090207202332-oc93rfjo1st0571s
Tags: 0.5.0.3-2
[ Mirco Bauer]
* Upload to unstable.
* debian/control:
  + Lowered GNOME# build-deps to 2.0 ABI as that transition didn't happen
    yet in unstable.

[ Iain Lane ]
* debian/patches/svn-r4545_locales-import.dpatch: Patch backported from SVN
  trunk revision 4545 - initialize the translation catalog earlier (LP: #293305)
  (Closes: #514457). Thanks to Florian Heinle for finding the patch and to
  Chris Coulson for preparing the update.
* debian/control: Build-depend on libmono-dev (>= 1.2.4) to match configure
  checks.
* debian/rules: Pass CSC=/usr/bin/csc to configure for gio-sharp to fix FTBFS

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
using System;
 
2
using Gdk;
 
3
using System.Runtime.InteropServices;
 
4
 
 
5
namespace FSpot.Utils {
 
6
        public class GdkUtils {
 
7
 
 
8
                class NativeMethods
 
9
                {
 
10
                        [DllImport("libgdk-2.0-0.dll")]
 
11
                        public static extern uint gdk_x11_drawable_get_xid (IntPtr d);
 
12
        
 
13
                        [DllImport("libgdk-2.0-0.dll")]
 
14
                        public static extern IntPtr gdk_x11_display_get_xdisplay (IntPtr d);
 
15
        
 
16
                        [DllImport("libgdk-2.0-0.dll")]
 
17
                        public static extern IntPtr gdk_x11_visual_get_xvisual (IntPtr d);
 
18
        
 
19
                        [DllImport("X11")]
 
20
                        public static extern uint XVisualIDFromVisual(IntPtr visual);
 
21
        
 
22
                        [DllImport("libgdk-2.0-0.dll")]
 
23
                        public static extern IntPtr gdk_x11_screen_lookup_visual (IntPtr screen,
 
24
                                                                           uint   xvisualid);
 
25
                }
 
26
 
 
27
                public static uint GetXid (Drawable d)
 
28
                {
 
29
                        return NativeMethods.gdk_x11_drawable_get_xid (d.Handle);
 
30
                }
 
31
 
 
32
                public static uint GetXVisualId (Visual visual)
 
33
                {
 
34
                        return NativeMethods.XVisualIDFromVisual (GetXVisual (visual));
 
35
                }
 
36
                
 
37
                public static IntPtr GetXDisplay (Display display)
 
38
                {
 
39
                        return NativeMethods.gdk_x11_display_get_xdisplay (display.Handle);
 
40
                }
 
41
                
 
42
                public static IntPtr GetXVisual (Visual v)
 
43
                {
 
44
                        return NativeMethods.gdk_x11_visual_get_xvisual (v.Handle);
 
45
                }
 
46
 
 
47
                public static Visual LookupVisual (Screen screen, uint visualid)
 
48
                {
 
49
                        return (Gdk.Visual) GLib.Object.GetObject (NativeMethods.gdk_x11_screen_lookup_visual (screen.Handle, visualid));
 
50
                }
 
51
                
 
52
                public static Cursor CreateEmptyCursor (Display display) 
 
53
                {
 
54
                        try {
 
55
                                Gdk.Pixbuf empty = new Gdk.Pixbuf (Gdk.Colorspace.Rgb, true, 8, 1, 1);
 
56
                                empty.Fill (0x00000000);
 
57
                                return new Gdk.Cursor (display, empty, 0, 0);
 
58
                        } catch (System.Exception e){
 
59
                                Log.Exception (e);
 
60
                                return null;
 
61
                        }
 
62
                }
 
63
        }
 
64
}