org.eclipse.swt.widgets.Shell.gdk_window_get_device_position()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(195)

本文整理了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

Shell.gdk_window_get_device_position介绍

暂无

代码示例

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc

  1. @Override
  2. int /*long*/ sizeAllocateProc (int /*long*/ handle, int /*long*/ arg0, int /*long*/ user_data) {
  3. int offset = 16;
  4. int [] x = new int [1], y = new int [1];
  5. gdk_window_get_device_position (0, x, y, null);
  6. y [0] += offset;
  7. int /*long*/ screen = OS.gdk_screen_get_default ();
  8. if (screen != 0) {
  9. int monitorNumber = OS.gdk_screen_get_monitor_at_point (screen, x[0], y[0]);
  10. GdkRectangle dest = new GdkRectangle ();
  11. OS.gdk_screen_get_monitor_geometry (screen, monitorNumber, dest);
  12. GtkAllocation allocation = new GtkAllocation ();
  13. OS.gtk_widget_get_allocation (handle, allocation);
  14. int width = allocation.width;
  15. int height = allocation.height;
  16. if (x[0] + width > dest.x + dest.width) {
  17. x [0] = (dest.x + dest.width) - width;
  18. }
  19. if (y[0] + height > dest.y + dest.height) {
  20. y[0] = (dest.y + dest.height) - height;
  21. }
  22. }
  23. OS.gtk_window_move (handle, x [0], y [0]);
  24. return 0;
  25. }

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x

  1. @Override
  2. long /*int*/ sizeAllocateProc (long /*int*/ handle, long /*int*/ arg0, long /*int*/ user_data) {
  3. int offset = 16;
  4. int [] x = new int [1], y = new int [1];
  5. gdk_window_get_device_position (0, x, y, null);
  6. y [0] += offset;
  7. long /*int*/ screen = OS.gdk_screen_get_default ();
  8. if (screen != 0) {
  9. int monitorNumber = OS.gdk_screen_get_monitor_at_point (screen, x[0], y[0]);
  10. GdkRectangle dest = new GdkRectangle ();
  11. OS.gdk_screen_get_monitor_geometry (screen, monitorNumber, dest);
  12. GtkAllocation allocation = new GtkAllocation ();
  13. OS.gtk_widget_get_allocation (handle, allocation);
  14. int width = allocation.width;
  15. int height = allocation.height;
  16. if (x[0] + width > dest.x + dest.width) {
  17. x [0] = (dest.x + dest.width) - width;
  18. }
  19. if (y[0] + height > dest.y + dest.height) {
  20. y[0] = (dest.y + dest.height) - height;
  21. }
  22. }
  23. OS.gtk_window_move (handle, x [0], y [0]);
  24. return 0;
  25. }

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc

  1. @Override
  2. int /*long*/ sizeAllocateProc (int /*long*/ handle, int /*long*/ arg0, int /*long*/ user_data) {
  3. int offset = 16;
  4. int [] x = new int [1], y = new int [1];
  5. gdk_window_get_device_position (0, x, y, null);
  6. y [0] += offset;
  7. int /*long*/ screen = OS.gdk_screen_get_default ();
  8. if (screen != 0) {
  9. int monitorNumber = OS.gdk_screen_get_monitor_at_point (screen, x[0], y[0]);
  10. GdkRectangle dest = new GdkRectangle ();
  11. OS.gdk_screen_get_monitor_geometry (screen, monitorNumber, dest);
  12. GtkAllocation allocation = new GtkAllocation ();
  13. OS.gtk_widget_get_allocation (handle, allocation);
  14. int width = allocation.width;
  15. int height = allocation.height;
  16. if (x[0] + width > dest.x + dest.width) {
  17. x [0] = (dest.x + dest.width) - width;
  18. }
  19. if (y[0] + height > dest.y + dest.height) {
  20. y[0] = (dest.y + dest.height) - height;
  21. }
  22. }
  23. OS.gtk_window_move (handle, x [0], y [0]);
  24. return 0;
  25. }

相关文章

Shell类方法