Search
lxdream.org :: lxdream/src/gtkui/gtk_win.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/gtkui/gtk_win.c
changeset 854:130928a3cdcb
prev850:28782ebbd01d
next887:8b3ee741c9d7
author nkeynes
date Tue Sep 09 00:51:43 2008 +0000 (11 years ago)
permissions -rw-r--r--
last change Add general gl_window_to_system_coords function to convert window system coordinates
back into something in the DC range of 640x480, update mouse events to use it
file annotate diff log raw
1.1 --- a/src/gtkui/gtk_win.c Mon Sep 08 07:56:33 2008 +0000
1.2 +++ b/src/gtkui/gtk_win.c Tue Sep 09 00:51:43 2008 +0000
1.3 @@ -128,16 +128,16 @@
1.4 gpointer user_data )
1.5 {
1.6 main_window_t win = (main_window_t)user_data;
1.7 - int32_t x = (int32_t)event->x;
1.8 - int32_t y = (int32_t)event->y;
1.9 + int x = (int)event->x;
1.10 + int y = (int)event->y;
1.11 if( win->is_grabbed &&
1.12 (x != win->mouse_x || y != win->mouse_y) ) {
1.13 input_event_mousemove( x - win->mouse_x, y - win->mouse_y, FALSE );
1.14 video_window_center_pointer(win);
1.15 } else {
1.16 int width, height;
1.17 - gdk_drawable_get_size(GDK_DRAWABLE(widget->window), &width, &height);
1.18 - input_event_mousemove( x * DISPLAY_WIDTH /width , y * DISPLAY_HEIGHT / height, TRUE );
1.19 + gl_window_to_system_coords( &x, &y );
1.20 + input_event_mousemove( x, y, TRUE );
1.21 }
1.22 return TRUE;
1.23 }
1.24 @@ -159,10 +159,10 @@
1.25 if( win->is_grabbed ) {
1.26 input_event_mousedown( event->button-1, 0, 0, FALSE );
1.27 } else {
1.28 - int width, height;
1.29 - gdk_drawable_get_size(GDK_DRAWABLE(widget->window), &width, &height);
1.30 - input_event_mousedown( event->button-1, (int32_t)event->x * DISPLAY_WIDTH / width,
1.31 - (int32_t)event->y * DISPLAY_HEIGHT / height, TRUE );
1.32 + int x = (int)event->x;
1.33 + int y = (int)event->y;
1.34 + gl_window_to_system_coords( &x, &y );
1.35 + input_event_mousedown( event->button-1, x, y, TRUE );
1.36 }
1.37 return TRUE;
1.38 }
1.39 @@ -176,10 +176,10 @@
1.40 } else if( win->use_grab) {
1.41 video_window_grab_display(win);
1.42 } else {
1.43 - int width, height;
1.44 - gdk_drawable_get_size(GDK_DRAWABLE(widget->window), &width, &height);
1.45 - input_event_mouseup( event->button-1, (int32_t)event->x * DISPLAY_WIDTH / width,
1.46 - (int32_t)event->y * DISPLAY_HEIGHT / height, TRUE );
1.47 + int x = (int)event->x;
1.48 + int y = (int)event->y;
1.49 + gl_window_to_system_coords( &x, &y );
1.50 + input_event_mouseup( event->button-1, x, y, TRUE );
1.51 }
1.52 return TRUE;
1.53 }
.