|
|
1.1 root 1: /* $Id: gtk-display.h,v 1.4 2003/10/16 02:48:23 fredette Exp $ */
2:
3: /* host/gtk/gtk-display.h - header file for GTK display support: */
4:
5: /*
6: * Copyright (c) 2003 Matt Fredette
7: * All rights reserved.
8: *
9: * Redistribution and use in source and binary forms, with or without
10: * modification, are permitted provided that the following conditions
11: * are met:
12: * 1. Redistributions of source code must retain the above copyright
13: * notice, this list of conditions and the following disclaimer.
14: * 2. Redistributions in binary form must reproduce the above copyright
15: * notice, this list of conditions and the following disclaimer in the
16: * documentation and/or other materials provided with the distribution.
17: * 3. All advertising materials mentioning features or use of this software
18: * must display the following acknowledgement:
19: * This product includes software developed by Matt Fredette.
20: * 4. The name of the author may not be used to endorse or promote products
21: * derived from this software without specific prior written permission.
22: *
23: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
24: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25: * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26: * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
27: * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28: * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
29: * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
31: * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32: * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33: * POSSIBILITY OF SUCH DAMAGE.
34: */
35:
36: #ifndef _HOST_GTK_GTK_DISPLAY_H
37: #define _HOST_GTK_GTK_DISPLAY_H
38:
39: #include <tme/common.h>
40: _TME_RCSID("$Id: gtk-display.h,v 1.4 2003/10/16 02:48:23 fredette Exp $");
41:
42: /* includes: */
43: #include <tme/generic/fb.h>
44: #include <tme/generic/keyboard.h>
45: #include <tme/generic/mouse.h>
46: #include <tme/threads.h>
47: #include <tme/hash.h>
48: #include <gtk/gtk.h>
49:
50: /* macros: */
51:
52: /* the callout flags: */
53: #define TME_GTK_DISPLAY_CALLOUT_CHECK (0)
54: #define TME_GTK_DISPLAY_CALLOUT_RUNNING TME_BIT(0)
55: #define TME_GTK_DISPLAY_CALLOUTS_MASK (-2)
56: #define TME_GTK_DISPLAY_CALLOUT_KEYBOARD_CTRL TME_BIT(1)
57: #define TME_GTK_DISPLAY_CALLOUT_MOUSE_CTRL TME_BIT(2)
58:
59: /* types: */
60:
61: struct tme_gtk_display;
62:
63: /* a screen: */
64: struct tme_gtk_screen {
65:
66: /* the next screen: */
67: struct tme_gtk_screen *tme_gtk_screen_next;
68:
69: /* a backpointer to the display: */
70: struct tme_gtk_display *tme_gtk_screen_display;
71:
72: /* the framebuffer connection. unlike many other elements, this is
73: *our* side of the framebuffer connection, not the peer's side: */
74: struct tme_fb_connection *tme_gtk_screen_fb;
75:
76: /* the current scaling. if this is < 0, the user has not forced a
77: given scaling yet: */
78: int tme_gtk_screen_fb_scale;
79:
80: /* the top-level window: */
81: GtkWidget *tme_gtk_screen_window;
82:
83: /* the outer vertical packing box: */
84: GtkWidget *tme_gtk_screen_vbox0;
85:
86: /* various menu item widgets: */
87: GtkWidget *tme_gtk_screen_scale_default;
88: GtkWidget *tme_gtk_screen_scale_half;
89:
90: /* when connected to a monochrome framebuffer, this is all-bits-one
91: iff a zero pixel should be drawn as white: */
92: gushort tme_gtk_screen_mono_invert_mask;
93:
94: /* the GtkEventBox, GdkImage and GtkImage for the framebuffer: */
95: GtkWidget *tme_gtk_screen_event_box;
96: GdkImage *tme_gtk_screen_gdkimage;
97: GtkWidget *tme_gtk_screen_gtkimage;
98:
99: /* the translation function: */
100: int (*tme_gtk_screen_fb_xlat) _TME_P((struct tme_fb_connection *,
101: struct tme_fb_connection *));
102:
103: /* the mouse on label: */
104: GtkWidget *tme_gtk_screen_mouse_label;
105:
106: /* the status bar, and the context ID: */
107: GtkWidget *tme_gtk_screen_mouse_statusbar;
108: guint tme_gtk_screen_mouse_statusbar_cid;
109:
110: /* if GDK_VoidSymbol, mouse mode is off. otherwise,
111: mouse mode is on, and this is the keyval that will
112: turn mouse mode off: */
113: guint tme_gtk_screen_mouse_keyval;
114:
115: /* when mouse mode is on, this is the previous events mask
116: for the framebuffer event box: */
117: GdkEventMask tme_gtk_screen_mouse_events_old;
118:
119: /* when mouse mode is on, this is the warp center: */
120: guint tme_gtk_screen_mouse_warp_x;
121: guint tme_gtk_screen_mouse_warp_y;
122:
123: /* when mouse mode is on, the last tme buttons state: */
124: unsigned int tme_gtk_screen_mouse_buttons_last;
125: };
126:
127: /* a GTK bad keysym: */
128: struct tme_gtk_keysym_bad {
129:
130: /* these are kept on a singly linked list: */
131: struct tme_gtk_keysym_bad *tme_gtk_keysym_bad_next;
132:
133: /* the bad keysym string: */
134: char *tme_gtk_keysym_bad_string;
135:
136: /* the flags and context used in the lookup: */
137: unsigned int tme_keysym_bad_flags;
138: unsigned int tme_gtk_keysym_bad_context_length;
139: tme_uint8_t *tme_gtk_keysym_bad_context;
140: };
141:
142: /* a display: */
143: struct tme_gtk_display {
144:
145: /* backpointer to our element: */
146: struct tme_element *tme_gtk_display_element;
147:
148: /* our mutex: */
149: tme_mutex_t tme_gtk_display_mutex;
150:
151: /* our keyboard connection: */
152: struct tme_keyboard_connection *tme_gtk_display_keyboard_connection;
153:
154: /* our keyboard buffer: */
155: struct tme_keyboard_buffer *tme_gtk_display_keyboard_buffer;
156:
157: /* our keysyms hash: */
158: tme_hash_t tme_gtk_display_keyboard_keysyms;
159:
160: /* the bad keysym records: */
161: struct tme_gtk_keysym_bad *tme_gtk_display_keyboard_keysyms_bad;
162:
163: /* our keysym to keycode hash: */
164: tme_hash_t tme_gtk_display_keyboard_keysym_to_keycode;
165:
166: /* our mouse connection: */
167: struct tme_mouse_connection *tme_gtk_display_mouse_connection;
168:
169: /* our mouse buffer: */
170: struct tme_mouse_buffer *tme_gtk_display_mouse_buffer;
171:
172: /* our mouse cursor: */
173: GdkCursor *tme_gtk_display_mouse_cursor;
174:
175: /* our screens: */
176: struct tme_gtk_screen *tme_gtk_display_screens;
177:
178: /* the callout flags: */
179: unsigned int tme_gtk_display_callout_flags;
180:
181: /* the tooltips group: */
182: GtkTooltips *tme_gtk_display_tooltips;
183: };
184:
185: /* prototypes: */
186: struct tme_gtk_screen *_tme_gtk_screen_new _TME_P((struct tme_gtk_display *));
187: int _tme_gtk_screen_connections_new _TME_P((struct tme_gtk_display *,
188: struct tme_connection **));
189: void _tme_gtk_keyboard_new _TME_P((struct tme_gtk_display *));
190: void _tme_gtk_keyboard_attach _TME_P((struct tme_gtk_screen *));
191: int _tme_gtk_keyboard_connections_new _TME_P((struct tme_gtk_display *,
192: struct tme_connection **));
193: void _tme_gtk_mouse_new _TME_P((struct tme_gtk_display *));
194: void _tme_gtk_mouse_mode_off _TME_P((struct tme_gtk_screen *, guint32));
195: void _tme_gtk_mouse_attach _TME_P((struct tme_gtk_screen *));
196: int _tme_gtk_mouse_connections_new _TME_P((struct tme_gtk_display *,
197: struct tme_connection **));
198: void _tme_gtk_screen_th_update _TME_P((struct tme_gtk_display *));
199: void _tme_gtk_display_callout _TME_P((struct tme_gtk_display *,
200: int));
201: gint _tme_gtk_display_enter_focus _TME_P((GtkWidget *, GdkEvent *, gpointer));
202:
203: #endif /* _HOST_GTK_GTK_DISPLAY_H */
204:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.