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 144:7f0714e89aaa
prev112:a3008ac0765a
next160:17c4c0e4f9ce
author nkeynes
date Mon May 15 08:28:52 2006 +0000 (14 years ago)
permissions -rw-r--r--
last change Rename video_driver to display_driver
Add input source to display
Implement configuration file support
Hook controllers up to configuration
file annotate diff log raw
1.1 --- a/src/drivers/video_gtk.c Thu Mar 16 12:42:28 2006 +0000
1.2 +++ b/src/drivers/video_gtk.c Mon May 15 08:28:52 2006 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: video_gtk.c,v 1.5 2006-03-16 12:42:28 nkeynes Exp $
1.6 + * $Id: video_gtk.c,v 1.6 2006-05-15 08:28:52 nkeynes Exp $
1.7 *
1.8 * The PC side of the video support (responsible for actually displaying /
1.9 * rendering frames)
1.10 @@ -20,7 +20,7 @@
1.11 #include <gnome.h>
1.12 #include <gdk/gdkx.h>
1.13 #include <stdint.h>
1.14 -#include "video.h"
1.15 +#include "display.h"
1.16 #include "drivers/video_x11.h"
1.17
1.18 GdkImage *video_img = NULL;
1.19 @@ -30,21 +30,45 @@
1.20 uint32_t video_height = 480;
1.21 uint32_t video_frame_count = 0;
1.22
1.23 +uint16_t video_gtk_resolve_keysym( const gchar *keysym );
1.24 gboolean video_gtk_set_output_format( uint32_t width, uint32_t height,
1.25 int colour_format );
1.26 gboolean video_gtk_set_render_format( uint32_t width, uint32_t height,
1.27 - int colour_format );
1.28 + int colour_format, gboolean texture );
1.29 gboolean video_gtk_display_frame( video_buffer_t frame );
1.30 gboolean video_gtk_blank( uint32_t rgb );
1.31
1.32 -struct video_driver video_gtk_driver = { "gtk",
1.33 - NULL,
1.34 - NULL,
1.35 - video_gtk_set_output_format,
1.36 - video_gtk_set_render_format,
1.37 - video_gtk_display_frame,
1.38 - video_gtk_blank,
1.39 - video_glx_swap_buffers };
1.40 +struct display_driver display_gtk_driver = { "gtk",
1.41 + NULL,
1.42 + NULL,
1.43 + video_gtk_resolve_keysym,
1.44 + video_gtk_set_output_format,
1.45 + video_gtk_set_render_format,
1.46 + video_gtk_display_frame,
1.47 + video_gtk_blank,
1.48 + video_glx_swap_buffers };
1.49 +
1.50 +gboolean video_gtk_keydown_callback(GtkWidget *widget,
1.51 + GdkEventKey *event,
1.52 + gpointer user_data)
1.53 +{
1.54 + input_event_keydown( event->keyval );
1.55 +}
1.56 +
1.57 +uint16_t video_gtk_resolve_keysym( const gchar *keysym )
1.58 +{
1.59 + int val = gdk_keyval_from_name( keysym );
1.60 + if( val == GDK_VoidSymbol )
1.61 + return 0;
1.62 + return (uint16_t)val;
1.63 +}
1.64 +
1.65 +gboolean video_gtk_keyup_callback(GtkWidget *widget,
1.66 + GdkEventKey *event,
1.67 + gpointer user_data)
1.68 +{
1.69 + input_event_keyup( event->keyval );
1.70 +}
1.71
1.72 gboolean video_gtk_set_output_format( uint32_t width, uint32_t height,
1.73 int colour_format )
1.74 @@ -57,6 +81,13 @@
1.75 gtk_window_set_policy( video_win, FALSE, FALSE, FALSE );
1.76 gtk_window_set_default_size( video_win, width, height );
1.77
1.78 + g_signal_connect( video_win, "key_press_event",
1.79 + G_CALLBACK(video_gtk_keydown_callback), NULL );
1.80 + g_signal_connect( video_win, "key_release_event",
1.81 + G_CALLBACK(video_gtk_keyup_callback), NULL );
1.82 + gtk_widget_add_events( GTK_WIDGET(video_win),
1.83 + GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK |
1.84 + GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK );
1.85 video_area = gtk_image_new();
1.86 gtk_widget_show( GTK_WIDGET(video_area) );
1.87 gtk_container_add( GTK_CONTAINER(video_win), GTK_WIDGET(video_area) );
1.88 @@ -156,7 +187,7 @@
1.89 }
1.90
1.91 gboolean video_gtk_set_render_format( uint32_t width, uint32_t height,
1.92 - int colour_format )
1.93 + int colour_format, gboolean texture )
1.94 {
1.95 return video_glx_set_render_format( 0, 0, width, height );
1.96 }
.