Search
lxdream.org :: lxdream/src/drivers/video_gtk.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/drivers/video_gtk.c
changeset 436:e8c461d2545e
prev435:7a5d71e8560b
next443:1163eb5c0590
author nkeynes
date Thu Oct 11 08:20:38 2007 +0000 (12 years ago)
permissions -rw-r--r--
last change Remove intermediate window and adjust size accordingly
file annotate diff log raw
1.1 --- a/src/drivers/video_gtk.c Wed Oct 10 11:02:04 2007 +0000
1.2 +++ b/src/drivers/video_gtk.c Thu Oct 11 08:20:38 2007 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: video_gtk.c,v 1.13 2007-10-10 11:02:04 nkeynes Exp $
1.6 + * $Id: video_gtk.c,v 1.14 2007-10-11 08:20:38 nkeynes Exp $
1.7 *
1.8 * The PC side of the video support (responsible for actually displaying /
1.9 * rendering frames)
1.10 @@ -25,11 +25,9 @@
1.11 #include "drivers/video_x11.h"
1.12 #include "gui/gtkui.h"
1.13
1.14 -GdkImage *video_img = NULL;
1.15 -GtkWidget *video_win = NULL;
1.16 -GtkWidget *video_area = NULL;
1.17 -uint32_t video_width = 640;
1.18 -uint32_t video_height = 480;
1.19 +static GtkWidget *video_win = NULL;
1.20 +int video_width = 640;
1.21 +int video_height = 480;
1.22
1.23 gboolean video_gtk_init();
1.24 void video_gtk_shutdown();
1.25 @@ -69,6 +67,12 @@
1.26 /* redisplay last frame */
1.27 }
1.28
1.29 +gboolean video_gtk_resize_callback(GtkWidget *widget, GdkEventConfigure *event, gpointer data )
1.30 +{
1.31 + video_width = event->width;
1.32 + video_height = event->height;
1.33 +}
1.34 +
1.35 gboolean video_gtk_init()
1.36 {
1.37 /*
1.38 @@ -86,22 +90,17 @@
1.39 G_CALLBACK(video_gtk_keyup_callback), NULL );
1.40 g_signal_connect( video_win, "expose_event",
1.41 G_CALLBACK(video_gtk_expose_callback), NULL );
1.42 + g_signal_connect( video_win, "configure_event",
1.43 + G_CALLBACK(video_gtk_resize_callback), NULL );
1.44 gtk_widget_add_events( video_win,
1.45 GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK |
1.46 GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK );
1.47 - video_area = gtk_image_new();
1.48 - gtk_widget_show( GTK_WIDGET(video_area) );
1.49 - gtk_container_add( GTK_CONTAINER(video_win), GTK_WIDGET(video_area) );
1.50 - gtk_widget_show( GTK_WIDGET(video_win) );
1.51 - video_img = gdk_image_new( GDK_IMAGE_FASTEST, gdk_visual_get_system(),
1.52 - video_width, video_height );
1.53 - gtk_image_set_from_image( GTK_IMAGE(video_area), video_img, NULL );
1.54 -
1.55 -
1.56 + video_width = video_win->allocation.width;
1.57 + video_height = video_win->allocation.height;
1.58 return video_glx_init( gdk_x11_display_get_xdisplay( gtk_widget_get_display(GTK_WIDGET(video_win))),
1.59 - gdk_x11_screen_get_xscreen( gtk_widget_get_screen(GTK_WIDGET(video_win))),
1.60 - GDK_WINDOW_XWINDOW( GTK_WIDGET(video_win)->window ),
1.61 - video_width, video_height, &display_gtk_driver );
1.62 + gdk_x11_screen_get_xscreen( gtk_widget_get_screen(GTK_WIDGET(video_win))),
1.63 + GDK_WINDOW_XWINDOW( GTK_WIDGET(video_win)->window ),
1.64 + video_width, video_height, &display_gtk_driver );
1.65 }
1.66
1.67 void video_gtk_shutdown()
.