Annotation of tme/host/gtk/gtk-display.h, revision 1.1.1.3

1.1.1.3 ! root        1: /* $Id: gtk-display.h,v 1.9 2007/08/25 19:52:23 fredette Exp $ */
1.1       root        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>
1.1.1.3 ! root       40: _TME_RCSID("$Id: gtk-display.h,v 1.9 2007/08/25 19:52:23 fredette Exp $");
1.1       root       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>
1.1.1.2   root       48: #ifndef G_ENABLE_DEBUG
                     49: #define G_ENABLE_DEBUG (0)
                     50: #endif /* !G_ENABLE_DEBUG */
1.1       root       51: #include <gtk/gtk.h>
                     52: 
                     53: /* macros: */
                     54: 
                     55: /* the callout flags: */
                     56: #define TME_GTK_DISPLAY_CALLOUT_CHECK          (0)
                     57: #define TME_GTK_DISPLAY_CALLOUT_RUNNING                TME_BIT(0)
                     58: #define TME_GTK_DISPLAY_CALLOUTS_MASK          (-2)
                     59: #define  TME_GTK_DISPLAY_CALLOUT_KEYBOARD_CTRL TME_BIT(1)
                     60: #define  TME_GTK_DISPLAY_CALLOUT_MOUSE_CTRL    TME_BIT(2)
                     61: 
                     62: /* types: */
                     63: 
                     64: struct tme_gtk_display;
                     65: 
                     66: /* a screen: */
                     67: struct tme_gtk_screen {
                     68: 
                     69:   /* the next screen: */
                     70:   struct tme_gtk_screen *tme_gtk_screen_next;
                     71: 
                     72:   /* a backpointer to the display: */
                     73:   struct tme_gtk_display *tme_gtk_screen_display;
                     74: 
                     75:   /* the framebuffer connection.  unlike many other elements, this is
                     76:      *our* side of the framebuffer connection, not the peer's side: */
                     77:   struct tme_fb_connection *tme_gtk_screen_fb;
                     78: 
                     79:   /* the current scaling.  if this is < 0, the user has not forced a
                     80:      given scaling yet: */
                     81:   int tme_gtk_screen_fb_scale;
                     82: 
1.1.1.3 ! root       83:   /* any colorset signature: */
        !            84:   tme_uint32_t tme_gtk_screen_colorset;
        !            85: 
1.1       root       86:   /* the top-level window: */
                     87:   GtkWidget *tme_gtk_screen_window;
                     88:   
                     89:   /* the outer vertical packing box: */
                     90:   GtkWidget *tme_gtk_screen_vbox0;
                     91: 
                     92:   /* various menu item widgets: */
                     93:   GtkWidget *tme_gtk_screen_scale_default;
                     94:   GtkWidget *tme_gtk_screen_scale_half;
                     95: 
                     96:   /* the GtkEventBox, GdkImage and GtkImage for the framebuffer: */
                     97:   GtkWidget *tme_gtk_screen_event_box;
                     98:   GdkImage *tme_gtk_screen_gdkimage;
                     99:   GtkWidget *tme_gtk_screen_gtkimage;
                    100: 
                    101:   /* the translation function: */
                    102:   int (*tme_gtk_screen_fb_xlat) _TME_P((struct tme_fb_connection *, 
                    103:                                        struct tme_fb_connection *));
                    104: 
                    105:   /* the mouse on label: */
                    106:   GtkWidget *tme_gtk_screen_mouse_label;
                    107: 
                    108:   /* the status bar, and the context ID: */
                    109:   GtkWidget *tme_gtk_screen_mouse_statusbar;
                    110:   guint tme_gtk_screen_mouse_statusbar_cid;
                    111: 
                    112:   /* if GDK_VoidSymbol, mouse mode is off.  otherwise,
                    113:      mouse mode is on, and this is the keyval that will
                    114:      turn mouse mode off: */
                    115:   guint tme_gtk_screen_mouse_keyval;
                    116: 
                    117:   /* when mouse mode is on, this is the previous events mask
                    118:      for the framebuffer event box: */
                    119:   GdkEventMask tme_gtk_screen_mouse_events_old;
                    120: 
                    121:   /* when mouse mode is on, this is the warp center: */
1.1.1.3 ! root      122:   gint tme_gtk_screen_mouse_warp_x;
        !           123:   gint tme_gtk_screen_mouse_warp_y;
1.1       root      124: 
                    125:   /* when mouse mode is on, the last tme buttons state: */
                    126:   unsigned int tme_gtk_screen_mouse_buttons_last;
                    127: };
                    128: 
                    129: /* a GTK bad keysym: */
                    130: struct tme_gtk_keysym_bad {
                    131: 
                    132:   /* these are kept on a singly linked list: */
                    133:   struct tme_gtk_keysym_bad *tme_gtk_keysym_bad_next;
                    134: 
                    135:   /* the bad keysym string: */
                    136:   char *tme_gtk_keysym_bad_string;
                    137: 
                    138:   /* the flags and context used in the lookup: */
                    139:   unsigned int tme_keysym_bad_flags;
                    140:   unsigned int tme_gtk_keysym_bad_context_length;
                    141:   tme_uint8_t *tme_gtk_keysym_bad_context;
                    142: };
                    143: 
                    144: /* a display: */
                    145: struct tme_gtk_display {
                    146: 
                    147:   /* backpointer to our element: */
                    148:   struct tme_element *tme_gtk_display_element;
                    149: 
                    150:   /* our mutex: */
                    151:   tme_mutex_t tme_gtk_display_mutex;
                    152: 
                    153:   /* our keyboard connection: */
                    154:   struct tme_keyboard_connection *tme_gtk_display_keyboard_connection;
                    155: 
                    156:   /* our keyboard buffer: */
                    157:   struct tme_keyboard_buffer *tme_gtk_display_keyboard_buffer;
                    158: 
                    159:   /* our keysyms hash: */
                    160:   tme_hash_t tme_gtk_display_keyboard_keysyms;
                    161: 
                    162:   /* the bad keysym records: */
                    163:   struct tme_gtk_keysym_bad *tme_gtk_display_keyboard_keysyms_bad;
                    164: 
                    165:   /* our keysym to keycode hash: */
                    166:   tme_hash_t tme_gtk_display_keyboard_keysym_to_keycode;
                    167: 
1.1.1.3 ! root      168:   /* the next keysym to allocate for an unknown keysym string: */
        !           169:   guint tme_gtk_display_keyboard_keysym_alloc_next;
        !           170: 
1.1       root      171:   /* our mouse connection: */
                    172:   struct tme_mouse_connection *tme_gtk_display_mouse_connection;
                    173: 
                    174:   /* our mouse buffer: */
                    175:   struct tme_mouse_buffer *tme_gtk_display_mouse_buffer;
                    176: 
                    177:   /* our mouse cursor: */
                    178:   GdkCursor *tme_gtk_display_mouse_cursor;
                    179: 
                    180:   /* our screens: */
                    181:   struct tme_gtk_screen *tme_gtk_display_screens;
                    182: 
                    183:   /* the callout flags: */
                    184:   unsigned int tme_gtk_display_callout_flags;
                    185: 
                    186:   /* the tooltips group: */
                    187:   GtkTooltips *tme_gtk_display_tooltips;
                    188: };
                    189: 
1.1.1.3 ! root      190: /* a menu item: */
        !           191: struct tme_gtk_display_menu_item {
        !           192: 
        !           193:   /* which menu item this is: */
        !           194:   unsigned int tme_gtk_display_menu_item_which;
        !           195: 
        !           196:   /* where to save the menu item widget: */
        !           197:   GtkWidget **tme_gtk_display_menu_item_widget;
        !           198: 
        !           199:   /* the string for the menu item label: */
        !           200:   const char *tme_gtk_display_menu_item_string;
        !           201: };
        !           202: 
        !           203: /* this generates menu items: */
        !           204: typedef GtkSignalFunc (*tme_gtk_display_menu_items_t) _TME_P((void *, struct tme_gtk_display_menu_item *));
        !           205: 
1.1       root      206: /* prototypes: */
                    207: struct tme_gtk_screen *_tme_gtk_screen_new _TME_P((struct tme_gtk_display *));
                    208: int _tme_gtk_screen_connections_new _TME_P((struct tme_gtk_display *, 
                    209:                                            struct tme_connection **));
                    210: void _tme_gtk_keyboard_new _TME_P((struct tme_gtk_display *));
                    211: void _tme_gtk_keyboard_attach _TME_P((struct tme_gtk_screen *));
                    212: int _tme_gtk_keyboard_connections_new _TME_P((struct tme_gtk_display *,
                    213:                                              struct tme_connection **));
                    214: void _tme_gtk_mouse_new _TME_P((struct tme_gtk_display *));
                    215: void _tme_gtk_mouse_mode_off _TME_P((struct tme_gtk_screen *, guint32));
                    216: void _tme_gtk_mouse_attach _TME_P((struct tme_gtk_screen *));
                    217: int _tme_gtk_mouse_connections_new _TME_P((struct tme_gtk_display *,
                    218:                                           struct tme_connection **));
                    219: void _tme_gtk_screen_th_update _TME_P((struct tme_gtk_display *));
                    220: void _tme_gtk_display_callout _TME_P((struct tme_gtk_display *,
                    221:                                      int));
                    222: gint _tme_gtk_display_enter_focus _TME_P((GtkWidget *, GdkEvent *, gpointer));
1.1.1.3 ! root      223: GtkWidget *_tme_gtk_display_menu_radio _TME_P((void *, tme_gtk_display_menu_items_t));
1.1       root      224: 
                    225: #endif /* _HOST_GTK_GTK_DISPLAY_H */
                    226: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.