gtk.c (5d7e601df37d8bdd490472fd4cfe3e4ca258df09) | gtk.c (0337e4123e62721bd0bcb4d5645fee2a31e8906d) |
---|---|
1/* 2 * GTK UI 3 * 4 * Copyright IBM, Corp. 2012 5 * 6 * Authors: 7 * Anthony Liguori <aliguori@us.ibm.com> 8 * --- 190 unchanged lines hidden (view full) --- 199 return; 200 } 201 202 if (!gtk_widget_get_realized(vc->gfx.drawing_area)) { 203 return; 204 } 205 206 window = gtk_widget_get_window(GTK_WIDGET(vc->gfx.drawing_area)); | 1/* 2 * GTK UI 3 * 4 * Copyright IBM, Corp. 2012 5 * 6 * Authors: 7 * Anthony Liguori <aliguori@us.ibm.com> 8 * --- 190 unchanged lines hidden (view full) --- 199 return; 200 } 201 202 if (!gtk_widget_get_realized(vc->gfx.drawing_area)) { 203 return; 204 } 205 206 window = gtk_widget_get_window(GTK_WIDGET(vc->gfx.drawing_area)); |
207 if (s->full_screen || qemu_input_is_absolute() || s->ptr_owner == vc) { | 207 if (s->full_screen || qemu_input_is_absolute(vc->gfx.dcl.con) || s->ptr_owner == vc) { |
208 gdk_window_set_cursor(window, s->null_cursor); 209 } else { 210 gdk_window_set_cursor(window, NULL); 211 } 212} 213 214static void gd_update_caption(GtkDisplayState *s) 215{ --- 232 unchanged lines hidden (view full) --- 448static void gd_mouse_set(DisplayChangeListener *dcl, 449 int x, int y, int visible) 450{ 451 VirtualConsole *vc = container_of(dcl, VirtualConsole, gfx.dcl); 452 GdkDisplay *dpy; 453 gint x_root, y_root; 454 455 if (!gtk_widget_get_realized(vc->gfx.drawing_area) || | 208 gdk_window_set_cursor(window, s->null_cursor); 209 } else { 210 gdk_window_set_cursor(window, NULL); 211 } 212} 213 214static void gd_update_caption(GtkDisplayState *s) 215{ --- 232 unchanged lines hidden (view full) --- 448static void gd_mouse_set(DisplayChangeListener *dcl, 449 int x, int y, int visible) 450{ 451 VirtualConsole *vc = container_of(dcl, VirtualConsole, gfx.dcl); 452 GdkDisplay *dpy; 453 gint x_root, y_root; 454 455 if (!gtk_widget_get_realized(vc->gfx.drawing_area) || |
456 qemu_input_is_absolute()) { | 456 qemu_input_is_absolute(dcl->con)) { |
457 return; 458 } 459 460 dpy = gtk_widget_get_display(vc->gfx.drawing_area); 461 gdk_window_get_root_coords(gtk_widget_get_window(vc->gfx.drawing_area), 462 x, y, &x_root, &y_root); 463 gdk_device_warp(gd_get_pointer(dpy), 464 gtk_widget_get_screen(vc->gfx.drawing_area), --- 219 unchanged lines hidden (view full) --- 684 685static void gd_mouse_mode_change(Notifier *notify, void *data) 686{ 687 GtkDisplayState *s; 688 int i; 689 690 s = container_of(notify, GtkDisplayState, mouse_mode_notifier); 691 /* release the grab at switching to absolute mode */ | 457 return; 458 } 459 460 dpy = gtk_widget_get_display(vc->gfx.drawing_area); 461 gdk_window_get_root_coords(gtk_widget_get_window(vc->gfx.drawing_area), 462 x, y, &x_root, &y_root); 463 gdk_device_warp(gd_get_pointer(dpy), 464 gtk_widget_get_screen(vc->gfx.drawing_area), --- 219 unchanged lines hidden (view full) --- 684 685static void gd_mouse_mode_change(Notifier *notify, void *data) 686{ 687 GtkDisplayState *s; 688 int i; 689 690 s = container_of(notify, GtkDisplayState, mouse_mode_notifier); 691 /* release the grab at switching to absolute mode */ |
692 if (qemu_input_is_absolute() && s->ptr_owner) { | 692 if (s->ptr_owner && qemu_input_is_absolute(s->ptr_owner->gfx.dcl.con)) { |
693 if (!s->ptr_owner->window) { 694 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(s->grab_item), 695 FALSE); 696 } else { 697 gd_ungrab_pointer(s); 698 } 699 } 700 for (i = 0; i < s->nb_vcs; i++) { --- 197 unchanged lines hidden (view full) --- 898 } 899 if (wh > fbh) { 900 my = (wh - fbh) / 2; 901 } 902 903 x = (motion->x - mx) / vc->gfx.scale_x * ws; 904 y = (motion->y - my) / vc->gfx.scale_y * ws; 905 | 693 if (!s->ptr_owner->window) { 694 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(s->grab_item), 695 FALSE); 696 } else { 697 gd_ungrab_pointer(s); 698 } 699 } 700 for (i = 0; i < s->nb_vcs; i++) { --- 197 unchanged lines hidden (view full) --- 898 } 899 if (wh > fbh) { 900 my = (wh - fbh) / 2; 901 } 902 903 x = (motion->x - mx) / vc->gfx.scale_x * ws; 904 y = (motion->y - my) / vc->gfx.scale_y * ws; 905 |
906 if (qemu_input_is_absolute()) { | 906 if (qemu_input_is_absolute(vc->gfx.dcl.con)) { |
907 if (x < 0 || y < 0 || 908 x >= surface_width(vc->gfx.ds) || 909 y >= surface_height(vc->gfx.ds)) { 910 return TRUE; 911 } 912 qemu_input_queue_abs(vc->gfx.dcl.con, INPUT_AXIS_X, x, 913 0, surface_width(vc->gfx.ds)); 914 qemu_input_queue_abs(vc->gfx.dcl.con, INPUT_AXIS_Y, y, 915 0, surface_height(vc->gfx.ds)); 916 qemu_input_event_sync(); 917 } else if (s->last_set && s->ptr_owner == vc) { 918 qemu_input_queue_rel(vc->gfx.dcl.con, INPUT_AXIS_X, x - s->last_x); 919 qemu_input_queue_rel(vc->gfx.dcl.con, INPUT_AXIS_Y, y - s->last_y); 920 qemu_input_event_sync(); 921 } 922 s->last_x = x; 923 s->last_y = y; 924 s->last_set = TRUE; 925 | 907 if (x < 0 || y < 0 || 908 x >= surface_width(vc->gfx.ds) || 909 y >= surface_height(vc->gfx.ds)) { 910 return TRUE; 911 } 912 qemu_input_queue_abs(vc->gfx.dcl.con, INPUT_AXIS_X, x, 913 0, surface_width(vc->gfx.ds)); 914 qemu_input_queue_abs(vc->gfx.dcl.con, INPUT_AXIS_Y, y, 915 0, surface_height(vc->gfx.ds)); 916 qemu_input_event_sync(); 917 } else if (s->last_set && s->ptr_owner == vc) { 918 qemu_input_queue_rel(vc->gfx.dcl.con, INPUT_AXIS_X, x - s->last_x); 919 qemu_input_queue_rel(vc->gfx.dcl.con, INPUT_AXIS_Y, y - s->last_y); 920 qemu_input_event_sync(); 921 } 922 s->last_x = x; 923 s->last_y = y; 924 s->last_set = TRUE; 925 |
926 if (!qemu_input_is_absolute() && s->ptr_owner == vc) { | 926 if (!qemu_input_is_absolute(vc->gfx.dcl.con) && s->ptr_owner == vc) { |
927 GdkScreen *screen = gtk_widget_get_screen(vc->gfx.drawing_area); 928 GdkDisplay *dpy = gtk_widget_get_display(widget); 929 GdkWindow *win = gtk_widget_get_window(widget); 930 GdkMonitor *monitor = gdk_display_get_monitor_at_window(dpy, win); 931 GdkRectangle geometry; 932 933 int xr = (int)motion->x_root; 934 int yr = (int)motion->y_root; --- 25 unchanged lines hidden (view full) --- 960 void *opaque) 961{ 962 VirtualConsole *vc = opaque; 963 GtkDisplayState *s = vc->s; 964 InputButton btn; 965 966 /* implicitly grab the input at the first click in the relative mode */ 967 if (button->button == 1 && button->type == GDK_BUTTON_PRESS && | 927 GdkScreen *screen = gtk_widget_get_screen(vc->gfx.drawing_area); 928 GdkDisplay *dpy = gtk_widget_get_display(widget); 929 GdkWindow *win = gtk_widget_get_window(widget); 930 GdkMonitor *monitor = gdk_display_get_monitor_at_window(dpy, win); 931 GdkRectangle geometry; 932 933 int xr = (int)motion->x_root; 934 int yr = (int)motion->y_root; --- 25 unchanged lines hidden (view full) --- 960 void *opaque) 961{ 962 VirtualConsole *vc = opaque; 963 GtkDisplayState *s = vc->s; 964 InputButton btn; 965 966 /* implicitly grab the input at the first click in the relative mode */ 967 if (button->button == 1 && button->type == GDK_BUTTON_PRESS && |
968 !qemu_input_is_absolute() && s->ptr_owner != vc) { | 968 !qemu_input_is_absolute(vc->gfx.dcl.con) && s->ptr_owner != vc) { |
969 if (!vc->window) { 970 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(s->grab_item), 971 TRUE); 972 } else { 973 gd_grab_pointer(vc, "relative-mode-click"); 974 } 975 return TRUE; 976 } --- 1554 unchanged lines hidden --- | 969 if (!vc->window) { 970 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(s->grab_item), 971 TRUE); 972 } else { 973 gd_grab_pointer(vc, "relative-mode-click"); 974 } 975 return TRUE; 976 } --- 1554 unchanged lines hidden --- |