本文整理了Java中org.eclipse.swt.widgets.Shell.gdk_window_get_device_position()
方法的一些代码示例,展示了Shell.gdk_window_get_device_position()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Shell.gdk_window_get_device_position()
方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Shell
类名称:Shell
方法名:gdk_window_get_device_position
暂无
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc
@Override
int /*long*/ sizeAllocateProc (int /*long*/ handle, int /*long*/ arg0, int /*long*/ user_data) {
int offset = 16;
int [] x = new int [1], y = new int [1];
gdk_window_get_device_position (0, x, y, null);
y [0] += offset;
int /*long*/ screen = OS.gdk_screen_get_default ();
if (screen != 0) {
int monitorNumber = OS.gdk_screen_get_monitor_at_point (screen, x[0], y[0]);
GdkRectangle dest = new GdkRectangle ();
OS.gdk_screen_get_monitor_geometry (screen, monitorNumber, dest);
GtkAllocation allocation = new GtkAllocation ();
OS.gtk_widget_get_allocation (handle, allocation);
int width = allocation.width;
int height = allocation.height;
if (x[0] + width > dest.x + dest.width) {
x [0] = (dest.x + dest.width) - width;
}
if (y[0] + height > dest.y + dest.height) {
y[0] = (dest.y + dest.height) - height;
}
}
OS.gtk_window_move (handle, x [0], y [0]);
return 0;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x
@Override
long /*int*/ sizeAllocateProc (long /*int*/ handle, long /*int*/ arg0, long /*int*/ user_data) {
int offset = 16;
int [] x = new int [1], y = new int [1];
gdk_window_get_device_position (0, x, y, null);
y [0] += offset;
long /*int*/ screen = OS.gdk_screen_get_default ();
if (screen != 0) {
int monitorNumber = OS.gdk_screen_get_monitor_at_point (screen, x[0], y[0]);
GdkRectangle dest = new GdkRectangle ();
OS.gdk_screen_get_monitor_geometry (screen, monitorNumber, dest);
GtkAllocation allocation = new GtkAllocation ();
OS.gtk_widget_get_allocation (handle, allocation);
int width = allocation.width;
int height = allocation.height;
if (x[0] + width > dest.x + dest.width) {
x [0] = (dest.x + dest.width) - width;
}
if (y[0] + height > dest.y + dest.height) {
y[0] = (dest.y + dest.height) - height;
}
}
OS.gtk_window_move (handle, x [0], y [0]);
return 0;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc
@Override
int /*long*/ sizeAllocateProc (int /*long*/ handle, int /*long*/ arg0, int /*long*/ user_data) {
int offset = 16;
int [] x = new int [1], y = new int [1];
gdk_window_get_device_position (0, x, y, null);
y [0] += offset;
int /*long*/ screen = OS.gdk_screen_get_default ();
if (screen != 0) {
int monitorNumber = OS.gdk_screen_get_monitor_at_point (screen, x[0], y[0]);
GdkRectangle dest = new GdkRectangle ();
OS.gdk_screen_get_monitor_geometry (screen, monitorNumber, dest);
GtkAllocation allocation = new GtkAllocation ();
OS.gtk_widget_get_allocation (handle, allocation);
int width = allocation.width;
int height = allocation.height;
if (x[0] + width > dest.x + dest.width) {
x [0] = (dest.x + dest.width) - width;
}
if (y[0] + height > dest.y + dest.height) {
y[0] = (dest.y + dest.height) - height;
}
}
OS.gtk_window_move (handle, x [0], y [0]);
return 0;
}
内容来源于网络,如有侵权,请联系作者删除!