This patch continues our work with gtk cursor implementation.

1) added one more check (for max cursor size) to gtk2 CreateCursor.
2) changed crHourGlass from GDK_CLOCK to more standard GDK_WATCH
3) added more undeclared gdk2 functions to gtk2extrah

please apply it

Paul Ishenin.
Index: gtk2/gtk2extrah.inc
===================================================================
--- gtk2/gtk2extrah.inc (revision 10629)
+++ gtk2/gtk2extrah.inc (working copy)
@@ -45,20 +45,32 @@
 
 {$endif}
 
-function gdk_screen_get_default: PGdkScreen; cdecl; external gdklib;
-
 procedure laz_gdk_gc_set_dashes(gc:PGdkGC; dash_offset:gint;
   dashlist:Pgint8; n:gint); cdecl; external gdkdll name 'gdk_gc_set_dashes';
 
-// gtk 2.2
+// gdk 2.2
 procedure gdk_display_get_pointer(display : PGdkDisplay; screen :PGdkScreen; x 
:Pgint; y : Pgint; mask : PGdkModifierType); cdecl; external gdklib;
 function gdk_display_get_default:PGdkDisplay; cdecl; external gdklib;
-
 procedure gdk_draw_pixbuf(drawable : PGdkDrawable; gc : PGdkGC; pixbuf : 
PGdkPixbuf; src_x, src_y, dest_x, dest_y, width, height : gint;
                                              dither : TGdkRgbDither; x_dither, 
y_dither : gint); cdecl; external gdklib;
-// gtk 2.4
+function gdk_screen_get_default: PGdkScreen; cdecl; external gdklib;
+
+// gdk 2.4
 function gdk_cursor_new_from_pixbuf(display: PGdkDisplay; pixbuf: PGdkPixbuf; 
x, y: gint): PGdkCursor; cdecl; external gdklib name 
'gdk_cursor_new_from_pixbuf';
+function gdk_display_get_default_cursor_size(display: PGdkDisplay): guint; 
cdecl; external gdklib;
+procedure gdk_display_get_maximal_cursor_size(display: PGdkDisplay; w, h: 
pguint); cdecl; external gdklib;
 
+{ for future use
+function gdk_display_supports_cursor_alpha(display: PGdkDisplay): gBoolean; 
cdecl; external gdklib;
+function gdk_display_supports_cursor_color(display: PGdkDisplay): gBoolean; 
cdecl; external gdklib;
 
+// gdk 2.8
+function gdk_cursor_get_image(cursor: PGdkCursor): PGdkPixbuf; cdecl; external 
gdklib;
+function gdk_cursor_new_from_name(display: PGdkDisplay; name: Pgchar): 
PGdkCursor; cdecl; external gdklib;
+function gdk_screen_get_rgba_colormap(screen: PGdkScreen): PGdkColormap; 
cdecl; external gdklib;
+function gdk_screen_get_rgba_visual(screen: PGdkScreen): PGdkVisual; cdecl; 
external gdklib;
+}
 
 
+
+
Index: gtk2/gtk2winapi.inc
===================================================================
--- gtk2/gtk2winapi.inc (revision 10629)
+++ gtk2/gtk2winapi.inc (working copy)
@@ -69,6 +69,7 @@
   pixmap: PGdkPixmap;
   bitmap: PGdkBitmap;
   w, h: integer;
+  max_w, max_h: guint;
   pixbuf, masked_pixbuf: PGdkPixbuf;
 begin
   Result := 0;
@@ -78,7 +79,17 @@
   bitmap := PGDIObject(ACursorInfo^.hbmColor)^.GDIBitmapMaskObject;
 
   gdk_drawable_get_size(pixmap, @w, @h);
+  gdk_display_get_maximal_cursor_size(gdk_display_get_default, @max_w, @max_h);
+  
+  if (w > max_w) or (h > max_h) then
+    exit;
 
+{
+  max_w := gdk_display_get_default_cursor_size(gdk_display_get_default);
+  if (w > max_w) or (h > max_w) then
+    DebugLn(['CreateCursor cursor size:',w,'x',h,' > default size:', max_w]);
+}
+
   // create alpha pixbuf
   pixbuf := gdk_pixbuf_new(GDK_COLORSPACE_RGB, True, 8, w, h);
 
Index: gtk/gtkobject.inc
===================================================================
--- gtk/gtkobject.inc   (revision 10629)
+++ gtk/gtkobject.inc   (working copy)
@@ -5276,7 +5276,7 @@
     crSizeS:    CursorValue := GDK_BOTTOM_SIDE;
     crSizeSE:   CursorValue := GDK_BOTTOM_RIGHT_CORNER;
     crUpArrow:  CursorValue := GDK_LEFT_PTR;
-    crHourGlass:CursorValue := GDK_CLOCK;
+    crHourGlass:CursorValue := GDK_WATCH;
     crHSplit:   CursorValue := GDK_SB_H_DOUBLE_ARROW;
     crVSplit:   CursorValue := GDK_SB_V_DOUBLE_ARROW;
     crNo:       CursorValue := GDK_LEFT_PTR;

Reply via email to