diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2020-08-24 21:26:53 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2020-08-24 21:26:53 +0200 |
commit | df247efec654e512242e4f4f1b0212034f9e01fe (patch) | |
tree | 25c02e16957f3aa613af30c140fd8e8a3d52fda6 /app/wlib/gtklib/util.c | |
parent | d0b6a8a4ec298024f14f704f9e40a6f9d324ccf3 (diff) | |
parent | a5ade52caa489cf0a713e0f02b764000d203140e (diff) |
Merge branch 'release/debian/1%5.2.0Beta2.1-1' into masterdebian/1%5.2.0Beta2.1-1
Diffstat (limited to 'app/wlib/gtklib/util.c')
-rw-r--r-- | app/wlib/gtklib/util.c | 88 |
1 files changed, 82 insertions, 6 deletions
diff --git a/app/wlib/gtklib/util.c b/app/wlib/gtklib/util.c index e6587a0..a265938 100644 --- a/app/wlib/gtklib/util.c +++ b/app/wlib/gtklib/util.c @@ -197,6 +197,8 @@ void * wlibAlloc( abort(); } + w->outline = FALSE; + w->type = type; w->parent = parent; w->origX = origX; @@ -369,7 +371,7 @@ void wFlush( void) { while (gtk_events_pending()) { - gtk_main_iteration(); + gtk_main_iteration_do(FALSE); } gdk_display_sync(gdk_display_get_default()); @@ -385,13 +387,81 @@ void wWinTop(wWin_p win) } /** - * Not implemented + * Set the cursor in GTK * * \param cursor IN */ -void wSetCursor(wCursor_t cursor) +void wSetCursor(wDraw_p bd, wCursor_t cursor) { + static GdkCursor * gdkcursors[wCursorQuestion+1]; + GdkCursor * gdkcursor; + //GdkWindow * gdkwindow = gtk_widget_get_window(GTK_WIDGET(win->gtkwin));; + GdkWindow * gdkwindow = gdk_get_default_root_window(); + GdkDisplay * display = gdk_window_get_display(gdkwindow); + if (!gdkcursors[cursor]) { + switch(cursor) { + case wCursorAppStart: + //gdkcursor = gdk_cursor_new_from_name (display,"progress"); + gdkcursor = gdk_cursor_new(GDK_WATCH); + break; + case wCursorHand: + //gdkcursor = gdk_cursor_new_from_name (display,"pointer"); + gdkcursor = gdk_cursor_new(GDK_HAND2); + break; + case wCursorNo: + //gdkcursor = gdk_cursor_new_from_name (display,"not-allowed"); + gdkcursor = gdk_cursor_new(GDK_X_CURSOR); + break; + case wCursorSizeAll: + //gdkcursor = gdk_cursor_new_from_name (display,"move"); + gdkcursor = gdk_cursor_new(GDK_FLEUR); + break; + case wCursorSizeNESW: + //gdkcursor = gdk_cursor_new_from_name (display,"nesw-resize"); + gdkcursor = gdk_cursor_new(GDK_BOTTOM_LEFT_CORNER); + break; + case wCursorSizeNS: + //gdkcursor = gdk_cursor_new_from_name (display,"ns-resize"); + gdkcursor = gdk_cursor_new(GDK_DOUBLE_ARROW); + break; + case wCursorSizeNWSE: + //gdkcursor = gdk_cursor_new_from_name (display,"nwse-resize"); + gdkcursor = gdk_cursor_new(GDK_BOTTOM_RIGHT_CORNER); + break; + case wCursorSizeWE: + //gdkcursor = gdk_cursor_new_from_name (display,"ew-resize"); + gdkcursor = gdk_cursor_new(GDK_SB_H_DOUBLE_ARROW); + break; + case wCursorWait: + //gdkcursor = gdk_cursor_new_from_name (display,"wait"); + gdkcursor = gdk_cursor_new(GDK_WATCH); + break; + case wCursorIBeam: + //gdkcursor = gdk_cursor_new_from_name (display,"text"); + gdkcursor = gdk_cursor_new(GDK_XTERM); + break; + case wCursorCross: + //gdkcursor = gdk_cursor_new_from_name (display,"crosshair"); + gdkcursor = gdk_cursor_new(GDK_TCROSS); + break; + case wCursorQuestion: + //gdkcursor = gdk_cursor_new_from_name (display,"help"); + gdkcursor = gdk_cursor_new(GDK_QUESTION_ARROW); + break; + case wCursorNone: + gdkcursor = gdk_cursor_new(GDK_BLANK_CURSOR); + case wCursorNormal: + default: + //gdkcursor = gdk_cursor_new_from_name (display,"default"); + gdkcursor = gdk_cursor_new(GDK_LEFT_PTR); + break; + + } + gdkcursors[cursor] = gdkcursor; + } else gdkcursor = gdkcursors[cursor]; + + gdk_window_set_cursor ( gtk_widget_get_window(bd->widget), gdkcursor); } /** @@ -413,11 +483,17 @@ const char * wMemStats(void) void wGetDisplaySize(wPos_t * w, wPos_t * h) { - - *w = gdk_screen_width(); - *h = gdk_screen_height(); + GdkScreen *screen = gdk_screen_get_default(); + guint monitor = gdk_screen_get_primary_monitor(screen); + GdkRectangle screen_geometry = { 0, 0, 0, 0 }; + + gdk_screen_get_monitor_geometry( screen, monitor, &screen_geometry ); + + *w = screen_geometry.width; + *h = screen_geometry.height; } + static dynArr_t conversionBuffer_da; /** |