summaryrefslogtreecommitdiff
path: root/app/wlib/gtklib/util.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2020-08-22 14:05:41 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2020-08-22 14:05:41 +0200
commitb55285a77da0e0b829e4ce8d7e09debaabc68e15 (patch)
treef622559ef65bbdd3e1c5bdb06098a8f89eec0563 /app/wlib/gtklib/util.c
parentd3897ce090dbeb220ed2c782f095597e417cf3cc (diff)
parentd1ae75703e1ed81d65ea16946dcdb77e7a13adc9 (diff)
Merge branch 'feature/upstream' into develop
Diffstat (limited to 'app/wlib/gtklib/util.c')
-rw-r--r--app/wlib/gtklib/util.c88
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;
/**