diff gtk4/dw.c @ 2506:fa976a5bc7bd

Add DW_FEATURE_WINDOW_PLACEMENT for platforms supporting arbitrary window placement. Several of the new platforms supported do not allow arbitrary window placement. GTK3/4 with Wayland does not allow you to specify the location, just the size. iOS and Android by default the window is the full screen, or fraction of it. GTK2/3/4 with X11, Windows, OS/2 and MacOS support arbitrary window placement.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Thu, 06 May 2021 23:19:46 +0000
parents 8f7c2f20c7c0
children cb795bba48a4
line wrap: on
line diff
--- a/gtk4/dw.c	Thu May 06 22:02:49 2021 +0000
+++ b/gtk4/dw.c	Thu May 06 23:19:46 2021 +0000
@@ -11057,6 +11057,23 @@
    return retval;
 }
 
+DW_FUNCTION_DEFINITION(dw_x11_check, int, int trueresult, int falseresult)
+DW_FUNCTION_ADD_PARAM1(handle)
+DW_FUNCTION_RETURN(dw_window_raise, int)
+DW_FUNCTION_RESTORE_PARAM1(trueresult, int, falseresult, int)
+{
+   int retval = falseresult;
+#ifdef GDK_WINDOWING_X11
+   GdkDisplay *display = gdk_display_get_default();
+
+   if(display && GDK_IS_X11_DISPLAY(display))
+   {
+      retval = trueresult;
+   }
+#endif
+   DW_FUNCTION_RETURN_THIS(retval);
+}
+
 /*
  * Gets the state of the requested library feature.
  * Parameters:
@@ -11080,6 +11097,8 @@
         case DW_FEATURE_MLE_WORD_WRAP:
         case DW_FEATURE_TREE:
             return DW_FEATURE_ENABLED;
+        case DW_FEATURE_WINDOW_PLACEMENT:
+            return dw_x11_check(DW_FEATURE_ENABLED, DW_FEATURE_UNSUPPORTED);
         default:
             return DW_FEATURE_UNSUPPORTED;
     }
@@ -11112,6 +11131,8 @@
         case DW_FEATURE_MLE_WORD_WRAP:
         case DW_FEATURE_TREE:
             return DW_ERROR_GENERAL;
+        case DW_FEATURE_WINDOW_PLACEMENT:
+            return dw_x11_check(DW_ERROR_GENERAL, DW_FEATURE_UNSUPPORTED);
         /* These features are supported and configurable */
         default:
             return DW_FEATURE_UNSUPPORTED;