symbian-qemu-0.9.1-12/qemu-symbian-svp/gui_host.h
changeset 1 2fb8b9db1c86
equal deleted inserted replaced
0:ffa851df0825 1:2fb8b9db1c86
       
     1 /*
       
     2  * GUI Host side interface
       
     3  *
       
     4  * Copyright (c) 2009 CodeSourcery
       
     5  *
       
     6  * Permission is hereby granted, free of charge, to any person obtaining a copy
       
     7  * of this software and associated documentation files (the "Software"), to deal
       
     8  * in the Software without restriction, including without limitation the rights
       
     9  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
       
    10  * copies of the Software, and to permit persons to whom the Software is
       
    11  * furnished to do so, subject to the following conditions:
       
    12  *
       
    13  * The above copyright notice and this permission notice shall be included in
       
    14  * all copies or substantial portions of the Software.
       
    15  *
       
    16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
       
    17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
       
    18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
       
    19  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
       
    20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
       
    21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
       
    22  * THE SOFTWARE.
       
    23  */
       
    24 
       
    25 #ifndef GUI_HOST_H
       
    26 #define GUI_HOST_H
       
    27 
       
    28 #define SKINNED_VT_PRIORITY_ORDER           10
       
    29 #define SKINLESS_GRAPHIC_VT_PRIORITY_ORDER  20
       
    30 #define SKINLESS_TEXT_VT_PRIORITY_ORDER     30
       
    31 
       
    32 typedef unsigned int DisplayID;
       
    33 typedef unsigned int VtID;
       
    34 typedef unsigned int ImageID;
       
    35 typedef unsigned int AreaID;
       
    36 
       
    37 
       
    38 /* DFG FIXME: move the DisplayState definition to gui.c (as internal implementation) */
       
    39 
       
    40 struct DisplayState {
       
    41     /* FIXME: Move away this from here (now in screen_data_t) */
       
    42     uint8_t *data;
       
    43     int linesize;
       
    44     int depth;
       
    45     int bgr; /* BGR color order instead of RGB. Only valid for depth == 32 */
       
    46     /*******************/
       
    47     int x0;
       
    48     int y0;
       
    49     int width;
       
    50     int height;
       
    51     VtID vtid;
       
    52     DisplayID dispid;
       
    53     void *opaque;
       
    54 
       
    55     void (*dpy_update)(struct DisplayState *s, int x, int y, int w, int h);
       
    56     void (*dpy_copy)(struct DisplayState *s, int src_x, int src_y,
       
    57                      int dst_x, int dst_y, int w, int h);
       
    58     void (*dpy_fill)(struct DisplayState *s, int x, int y,
       
    59                      int w, int h, uint32_t c);
       
    60     void (*dpy_text_cursor)(struct DisplayState *s, int x, int y);
       
    61     void (*mouse_set)(int x, int y, int on);
       
    62     void (*cursor_define)(int width, int height, int bpp, int hot_x, int hot_y,
       
    63                           uint8_t *image, uint8_t *mask);
       
    64 };
       
    65 
       
    66 /****************************************************/
       
    67 
       
    68 /* in ms */
       
    69 #define GUI_REFRESH_INTERVAL 30
       
    70 
       
    71 /************ HOST SIDE INTERFACE ************/
       
    72 
       
    73 void kbd_mouse_event(int dx, int dy, int dz, int buttons_state);
       
    74 int kbd_mouse_is_absolute(void);
       
    75 void do_info_mice(void);
       
    76 void do_mouse_set(int index);
       
    77 
       
    78 /* to be used by sdl.c or vnc.c */
       
    79 
       
    80 typedef enum
       
    81 {
       
    82     GUI_CURSOR_NORMAL,
       
    83     GUI_CURSOR_GRABBING,
       
    84     GUI_CURSOR_GUEST_SPRITE,
       
    85     GUI_CURSOR_HIDDEN, /* What is this for? */
       
    86 } gui_cursor_type_t;
       
    87 
       
    88 typedef struct {
       
    89     /* this was in DisplayState */
       
    90     uint8_t *data;
       
    91     int linesize;
       
    92     int depth;
       
    93     int bgr; /* BGR color order instead of RGB. Only valid for depth == 32 */
       
    94     int height;
       
    95     int width;
       
    96 } screen_data_t;
       
    97 
       
    98 typedef struct
       
    99 {
       
   100     void (*turn_cursor_on)(gui_cursor_type_t);
       
   101     void (*turn_cursor_off)(void);
       
   102     void (*grab_input_on)(void);
       
   103     void (*grab_input_off)(void);
       
   104     void (*mouse_warp)(int x, int y);
       
   105     void (*set_caption)(const char* title, const char* icon);
       
   106     int  (*is_app_active)(void);
       
   107     void (*set_screen_size)(int width, int height, int on);
       
   108     void (*get_screen_data)(screen_data_t *new_screen_data);
       
   109     void (*init_ds)(struct DisplayState *ds);
       
   110     void (*process_events)(void);
       
   111     void (*set_kbd_terminal_mode)(int on);
       
   112 }gui_host_callbacks_t;
       
   113 
       
   114 void gui_init(gui_host_callbacks_t* callbacks);
       
   115 int gui_load(const char *xml_file);
       
   116 void gui_unload(void);
       
   117 DisplayState *gui_new_vt(int order_priority);
       
   118 int gui_needs_timer(void);
       
   119 void gui_set_timer(struct QEMUTimer *timer);
       
   120 void gui_refresh_caption(void);
       
   121 void gui_destroy(void);
       
   122 void gui_set_paint_callbacks(DisplayState *ds,
       
   123                              vga_hw_update_ptr update,
       
   124                              vga_hw_invalidate_ptr invalidate,
       
   125                              vga_hw_screen_dump_ptr screen_dump,
       
   126                              void *opaque);
       
   127 void gui_show_image(VtID vtid, ImageID id);
       
   128 void gui_hide_image(VtID vtid, ImageID id);
       
   129 
       
   130 /* Queries */
       
   131 int gui_allows_fullscreen(void); /* returns 0 or 1 */
       
   132 int gui_is_display_active(DisplayState *ds);
       
   133 
       
   134 /* Events */
       
   135 void gui_notify_toggle_fullscreen(void);
       
   136 void gui_notify_toggle_grabmode(void);
       
   137 void gui_notify_mouse_motion(int dx, int dy, int dz, int x, int y, int state);
       
   138 void gui_notify_mouse_button(int dz, int x, int y, int state);
       
   139 void gui_notify_mouse_warp(int x, int y, int on);
       
   140 void gui_notify_dev_key(int key);
       
   141 void gui_notify_term_key(int key);
       
   142 void gui_notify_console_select(int console); /* console is not the VtID, but the ordinal # */
       
   143 void gui_notify_activate_display(DisplayState *ds);
       
   144 void gui_notify_new_guest_cursor(void);
       
   145 void gui_notify_input_focus_lost(void);
       
   146 void gui_notify_app_focus(int gain);
       
   147 void gui_notify_idle(int idle);
       
   148 void gui_notify_update_tick(int64_t ticks);
       
   149 void gui_notify_repaint_screen(void);
       
   150 void gui_notify_screen_dump(const char *filename);
       
   151 
       
   152 #define DEF_BACKGROUND_IMAGE (ImageID)0  /* Default Background is always 0 */
       
   153 
       
   154 #endif
       
   155