modules/graphics/src/main/native-glass/gtk/glass_screen.cpp

Print this page




  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 #include <stdlib.h>
  27 
  28 #include "glass_screen.h"
  29 #include "glass_general.h"
  30 
  31 #include <X11/Xatom.h>
  32 #include <gdk/gdk.h>
  33 #include <gdk/gdkx.h>
  34 #include <gio/gio.h>



  35 
  36 jfloat OverrideUIScale = -1.0f;
  37 
  38 static guint get_current_desktop(GdkScreen *screen) {
  39     Display* display = gdk_x11_display_get_xdisplay(gdk_display_get_default());
  40     Atom currentDesktopAtom = XInternAtom(display, "_NET_CURRENT_DESKTOP", True);
  41     guint ret = 0;
  42 
  43     Atom type;
  44     int format;
  45     gulong num, left;
  46     unsigned long *data = NULL;
  47 
  48     if (currentDesktopAtom == None) {
  49         return 0;
  50     }
  51 
  52     int result = XGetWindowProperty(display,
  53                                     GDK_WINDOW_XID(gdk_screen_get_root_window(screen)),
  54                                     currentDesktopAtom, 0, G_MAXLONG, False, XA_CARDINAL,




  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 #include <stdlib.h>
  27 
  28 #include "glass_screen.h"
  29 #include "glass_general.h"
  30 
  31 #include <X11/Xatom.h>
  32 #include <gdk/gdk.h>
  33 #include <gdk/gdkx.h>
  34 
  35 extern "C" {
  36     #include <gio/gio.h>
  37 }
  38 
  39 jfloat OverrideUIScale = -1.0f;
  40 
  41 static guint get_current_desktop(GdkScreen *screen) {
  42     Display* display = gdk_x11_display_get_xdisplay(gdk_display_get_default());
  43     Atom currentDesktopAtom = XInternAtom(display, "_NET_CURRENT_DESKTOP", True);
  44     guint ret = 0;
  45 
  46     Atom type;
  47     int format;
  48     gulong num, left;
  49     unsigned long *data = NULL;
  50 
  51     if (currentDesktopAtom == None) {
  52         return 0;
  53     }
  54 
  55     int result = XGetWindowProperty(display,
  56                                     GDK_WINDOW_XID(gdk_screen_get_root_window(screen)),
  57                                     currentDesktopAtom, 0, G_MAXLONG, False, XA_CARDINAL,