< prev index next >

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

Print this page


   1 /*
   2  * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  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


 102 static jobject createJavaScreen(JNIEnv* env, GdkScreen* screen, gint monitor_idx)
 103 {
 104     GdkRectangle workArea = get_screen_workarea(screen);
 105     LOG4("Work Area: x:%d, y:%d, w:%d, h:%d\n", workArea.x, workArea.y, workArea.width, workArea.height);
 106 
 107     GdkRectangle monitor_geometry;
 108     gdk_screen_get_monitor_geometry(screen, monitor_idx, &monitor_geometry);
 109     LOG1("convert monitor[%d] -> glass Screen\n", monitor_idx)
 110     LOG4("[x: %d y: %d w: %d h: %d]\n",
 111          monitor_geometry.x, monitor_geometry.y,
 112          monitor_geometry.width, monitor_geometry.height)
 113 
 114     GdkVisual* visual = gdk_screen_get_system_visual(screen);
 115 
 116     GdkRectangle working_monitor_geometry;
 117     gdk_rectangle_intersect(&workArea, &monitor_geometry, &working_monitor_geometry);
 118 
 119     jobject jScreen = env->NewObject(jScreenCls, jScreenInit,
 120                                      (jlong)monitor_idx,
 121 
 122                                      visual ? visual->depth : 0,
 123 
 124                                      monitor_geometry.x,
 125                                      monitor_geometry.y,
 126                                      monitor_geometry.width,
 127                                      monitor_geometry.height,
 128 
 129                                      working_monitor_geometry.x,
 130                                      working_monitor_geometry.y,
 131                                      working_monitor_geometry.width,
 132                                      working_monitor_geometry.height,
 133 
 134                                      (jint)gdk_screen_get_resolution(screen),
 135                                      (jint)gdk_screen_get_resolution(screen),
 136                                      1.0f);
 137     JNI_EXCEPTION_TO_CPP(env);
 138     return jScreen;
 139 }
 140 
 141 jobject createJavaScreen(JNIEnv* env, gint monitor_idx) {
 142     GdkScreen *default_gdk_screen = gdk_screen_get_default();


   1 /*
   2  * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  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


 102 static jobject createJavaScreen(JNIEnv* env, GdkScreen* screen, gint monitor_idx)
 103 {
 104     GdkRectangle workArea = get_screen_workarea(screen);
 105     LOG4("Work Area: x:%d, y:%d, w:%d, h:%d\n", workArea.x, workArea.y, workArea.width, workArea.height);
 106 
 107     GdkRectangle monitor_geometry;
 108     gdk_screen_get_monitor_geometry(screen, monitor_idx, &monitor_geometry);
 109     LOG1("convert monitor[%d] -> glass Screen\n", monitor_idx)
 110     LOG4("[x: %d y: %d w: %d h: %d]\n",
 111          monitor_geometry.x, monitor_geometry.y,
 112          monitor_geometry.width, monitor_geometry.height)
 113 
 114     GdkVisual* visual = gdk_screen_get_system_visual(screen);
 115 
 116     GdkRectangle working_monitor_geometry;
 117     gdk_rectangle_intersect(&workArea, &monitor_geometry, &working_monitor_geometry);
 118 
 119     jobject jScreen = env->NewObject(jScreenCls, jScreenInit,
 120                                      (jlong)monitor_idx,
 121 
 122                                      (visual ? glass_gdk_visual_get_depth(visual) : 0),
 123 
 124                                      monitor_geometry.x,
 125                                      monitor_geometry.y,
 126                                      monitor_geometry.width,
 127                                      monitor_geometry.height,
 128 
 129                                      working_monitor_geometry.x,
 130                                      working_monitor_geometry.y,
 131                                      working_monitor_geometry.width,
 132                                      working_monitor_geometry.height,
 133 
 134                                      (jint)gdk_screen_get_resolution(screen),
 135                                      (jint)gdk_screen_get_resolution(screen),
 136                                      1.0f);
 137     JNI_EXCEPTION_TO_CPP(env);
 138     return jScreen;
 139 }
 140 
 141 jobject createJavaScreen(JNIEnv* env, gint monitor_idx) {
 142     GdkScreen *default_gdk_screen = gdk_screen_get_default();


< prev index next >