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 635:76c63aac3590
prev620:d9b28f78b952
next1066:ddffe9d2b332
author nkeynes
date Thu Feb 14 13:54:11 2008 +0000 (11 years ago)
branchlxdream-render
permissions -rw-r--r--
last change Commit render work in progress. Main changes:
* Preliminary OSMesa support
* Move the generic gl code out to pvr2/
* Implement scene data structure + reader
* Remove the 1/z adjustments
file annotate diff log raw
1.1 --- a/src/drivers/video_gtk.c Wed Jan 30 11:31:21 2008 +0000
1.2 +++ b/src/drivers/video_gtk.c Thu Feb 14 13:54:11 2008 +0000
1.3 @@ -24,11 +24,11 @@
1.4 #include "display.h"
1.5 #include "dckeysyms.h"
1.6 #include "drivers/video_glx.h"
1.7 -#include "drivers/gl_common.h"
1.8 +#include "drivers/video_gl.h"
1.9 #include "pvr2/pvr2.h"
1.10 #include "gtkui/gtkui.h"
1.11
1.12 -static GtkWidget *video_win = NULL;
1.13 +GtkWidget *gtk_video_win = NULL;
1.14 int video_width = 640;
1.15 int video_height = 480;
1.16
1.17 @@ -154,23 +154,28 @@
1.18 gboolean video_gtk_init()
1.19 {
1.20
1.21 - video_win = gtk_gui_get_renderarea();
1.22 - if( video_win == NULL ) {
1.23 + gtk_video_win = gtk_gui_get_renderarea();
1.24 + if( gtk_video_win == NULL ) {
1.25 return FALSE;
1.26 }
1.27
1.28 - g_signal_connect( video_win, "expose_event",
1.29 + g_signal_connect( gtk_video_win, "expose_event",
1.30 G_CALLBACK(video_gtk_expose_callback), NULL );
1.31 - g_signal_connect( video_win, "configure_event",
1.32 + g_signal_connect( gtk_video_win, "configure_event",
1.33 G_CALLBACK(video_gtk_resize_callback), NULL );
1.34 - video_width = video_win->allocation.width;
1.35 - video_height = video_win->allocation.height;
1.36 - Display *display = gdk_x11_display_get_xdisplay( gtk_widget_get_display(GTK_WIDGET(video_win)));
1.37 - Window window = GDK_WINDOW_XWINDOW( GTK_WIDGET(video_win)->window );
1.38 + video_width = gtk_video_win->allocation.width;
1.39 + video_height = gtk_video_win->allocation.height;
1.40 + Display *display = gdk_x11_display_get_xdisplay( gtk_widget_get_display(GTK_WIDGET(gtk_video_win)));
1.41 + Window window = GDK_WINDOW_XWINDOW( GTK_WIDGET(gtk_video_win)->window );
1.42 +#ifdef HAVE_LIBOSMESA
1.43 + video_gdk_init_driver( &display_gtk_driver );
1.44 +#else
1.45 if( ! video_glx_init_context( display, window ) ||
1.46 ! video_glx_init_driver( &display_gtk_driver ) ) {
1.47 return FALSE;
1.48 }
1.49 +#endif
1.50 +
1.51 #ifdef HAVE_LINUX_JOYSTICK
1.52 linux_joystick_init();
1.53 #endif
1.54 @@ -179,21 +184,34 @@
1.55
1.56 gboolean video_gtk_display_blank( uint32_t colour )
1.57 {
1.58 - GdkGC *gc = gdk_gc_new(video_win->window);
1.59 + GdkGC *gc = gdk_gc_new(gtk_video_win->window);
1.60 GdkColor color = {0, ((colour>>16)&0xFF)*257, ((colour>>8)&0xFF)*257, ((colour)&0xFF)*257 };
1.61 GdkColormap *cmap = gdk_colormap_get_system();
1.62 gdk_colormap_alloc_color( cmap, &color, TRUE, TRUE );
1.63 gdk_gc_set_foreground( gc, &color );
1.64 gdk_gc_set_background( gc, &color );
1.65 - gdk_draw_rectangle( video_win->window, gc, TRUE, 0, 0, video_width, video_height );
1.66 + gdk_draw_rectangle( gtk_video_win->window, gc, TRUE, 0, 0, video_width, video_height );
1.67 gdk_gc_destroy(gc);
1.68 gdk_colormap_free_colors( cmap, &color, 1 );
1.69 }
1.70
1.71 +XVisualInfo *video_gtk_get_visual()
1.72 +{
1.73 +#ifdef HAVE_LIBOSMESA
1.74 + return NULL;
1.75 +#else
1.76 + return video_glx_get_visual();
1.77 +#endif
1.78 +}
1.79 +
1.80 void video_gtk_shutdown()
1.81 {
1.82 - if( video_win != NULL ) {
1.83 + if( gtk_video_win != NULL ) {
1.84 +#ifdef HAVE_LIBOSMESA
1.85 + video_gdk_shutdown();
1.86 +#else
1.87 video_glx_shutdown();
1.88 +#endif
1.89 }
1.90 #ifdef HAVE_LINUX_JOYSTICK
1.91 linux_joystick_shutdown();
.