Search
lxdream.org :: lxdream :: r552:02ddb55a507b
lxdream 0.9.1
released Jun 29
Download Now
changeset552:02ddb55a507b
parent551:07125ce718da
child553:4e6166258c22
authornkeynes
dateWed Dec 19 00:47:13 2007 +0000 (11 years ago)
Fix video_gtk_init() not returning a failing status if the glx init failed
Add a gtk-based blank method to prevent crash on expose
src/drivers/video_gtk.c
1.1 --- a/src/drivers/video_gtk.c Mon Dec 10 05:32:21 2007 +0000
1.2 +++ b/src/drivers/video_gtk.c Wed Dec 19 00:47:13 2007 +0000
1.3 @@ -32,11 +32,13 @@
1.4
1.5 gboolean video_gtk_init();
1.6 void video_gtk_shutdown();
1.7 +gboolean video_gtk_display_blank( uint32_t colour );
1.8 uint16_t video_gtk_resolve_keysym( const gchar *keysym );
1.9
1.10 struct display_driver display_gtk_driver = { "gtk", video_gtk_init, video_gtk_shutdown,
1.11 video_gtk_resolve_keysym,
1.12 - NULL, NULL, NULL, NULL, NULL, NULL, NULL };
1.13 + NULL, NULL, NULL, NULL, NULL,
1.14 + video_gtk_display_blank, NULL };
1.15
1.16 /**
1.17 * Extract the keyval of the key event if no modifier keys were pressed -
1.18 @@ -121,8 +123,24 @@
1.19 video_height = video_win->allocation.height;
1.20 Display *display = gdk_x11_display_get_xdisplay( gtk_widget_get_display(GTK_WIDGET(video_win)));
1.21 Window window = GDK_WINDOW_XWINDOW( GTK_WIDGET(video_win)->window );
1.22 - video_glx_init_context( display, window );
1.23 - video_glx_init_driver( &display_gtk_driver );
1.24 + if( ! video_glx_init_context( display, window ) ||
1.25 + ! video_glx_init_driver( &display_gtk_driver ) ) {
1.26 + return FALSE;
1.27 + }
1.28 + return TRUE;
1.29 +}
1.30 +
1.31 +gboolean video_gtk_display_blank( uint32_t colour )
1.32 +{
1.33 + GdkGC *gc = gdk_gc_new(video_win->window);
1.34 + GdkColor color = {0, ((colour>>16)&0xFF)*257, ((colour>>8)&0xFF)*257, ((colour)&0xFF)*257 };
1.35 + GdkColormap *cmap = gdk_colormap_get_system();
1.36 + gdk_colormap_alloc_color( cmap, &color, TRUE, TRUE );
1.37 + gdk_gc_set_foreground( gc, &color );
1.38 + gdk_gc_set_background( gc, &color );
1.39 + gdk_draw_rectangle( video_win->window, gc, TRUE, 0, 0, video_width, video_height );
1.40 + gdk_gc_destroy(gc);
1.41 + gdk_colormap_free_colors( cmap, &color, 1 );
1.42 }
1.43
1.44 void video_gtk_shutdown()
.