Re: Detecting the gdk backend

2019-02-07 Thread rastersoft

Hi:

You have the GDK_IS_WAYLAND_DISPLAY() C macro. You have an example in my 
program Terminus ( https://gitlab.com/rastersoft/terminus ), in the 
'checkwayland.c' and 'checkwayland.vapi' files (which is also an example 
of how to do it in Vala, BTW).


El 8/2/19 a las 6:28, Daniel Kasak via gtk-app-devel-list escribió:

Hi all. Is there a way to detect the gdk backend an app is using? I know
about the environment variable - GDK_BACKEND. But often this is not set,
and gtk just picks whatever's available. I need ever-so-slightly different
app behaviour, depending on the backend. Any ideas?

Dan
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


--
Nos leemos
 RASTER(Linux user #228804)
ras...@rastersoft.com  http://www.rastersoft.com

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Detecting the gdk backend

2019-02-07 Thread Luca Bacci via gtk-app-devel-list
Hi! There is some reference code here:
https://developer.gnome.org/gdk3/stable/gdk3-Wayland-Interaction.html
https://developer.gnome.org/gdk3/stable/gdk3-X-Window-System-Interaction.html

   - Include the backend specific headers: gdk/gdkx.h, gdk/gdkwayland.h
   - Link with backend specific libs: gdk-x11-3.0.pc, gdk-wayland-3.0.pc
   - Check the backend for the default display: if
   (GDK_IS_X11_DISPLAY(gdk_display_get_default())) { /*...*/ }

Here is an example:

/* compile with
cc -o print-gdk-backend print-gdk-backend.c \
$(pkg-config --cflags --libs gtk+-3.0 gdk-x11-3.0 gdk-wayland-3.0)
*/

#include 
#ifdef GDK_WINDOWING_X11
#include 
#endif
#ifdef GDK_WINDOWING_WAYLAND
#include 
#endif
/*
   GDK_WINDOWING macros are defined in header
   /usr/include/gtk-3.0/gdk/gdkconfig.h
*/

int main() {
  gtk_init(NULL, NULL);

#ifdef GDK_WINDOWING_X11
  if (GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
g_print("X11 backend\n");
  }
#endif
#ifdef GDK_WINDOWING_WAYLAND
  if (GDK_IS_WAYLAND_DISPLAY(gdk_display_get_default())) {
g_print("Wayland backend\n");
  }
#endif

  return 0;
}


Il giorno gio 7 feb 2019 alle ore 06:28 Daniel Kasak via gtk-app-devel-list
 ha scritto:

> Hi all. Is there a way to detect the gdk backend an app is using? I know
> about the environment variable - GDK_BACKEND. But often this is not set,
> and gtk just picks whatever's available. I need ever-so-slightly different
> app behaviour, depending on the backend. Any ideas?
>
> Dan
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Detecting the gdk backend

2019-02-06 Thread Daniel Kasak via gtk-app-devel-list
Hi all. Is there a way to detect the gdk backend an app is using? I know
about the environment variable - GDK_BACKEND. But often this is not set,
and gtk just picks whatever's available. I need ever-so-slightly different
app behaviour, depending on the backend. Any ideas?

Dan
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list