ui.h

Go to the documentation of this file.
00001 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
00002 
00003 /* Metacity interface for talking to GTK+ UI module */
00004 
00005 /* 
00006  * Copyright (C) 2001 Havoc Pennington
00007  * 
00008  * This program is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU General Public License as
00010  * published by the Free Software Foundation; either version 2 of the
00011  * License, or (at your option) any later version.
00012  *
00013  * This program is distributed in the hope that it will be useful, but
00014  * WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016  * General Public License for more details.
00017  * 
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program; if not, write to the Free Software
00020  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00021  * 02111-1307, USA.
00022  */
00023 
00024 #ifndef META_UI_H
00025 #define META_UI_H
00026 
00027 /* Don't include gtk.h or gdk.h here */
00028 #include "common.h"
00029 #include <X11/Xlib.h>
00030 #include <X11/Xutil.h>
00031 #include <glib.h>
00032 #include <gdk-pixbuf/gdk-pixbuf.h>
00033 
00034 /* This is between GTK_PRIORITY_RESIZE (+10) and GTK_PRIORITY_REDRAW (+20) */
00035 #define META_PRIORITY_RESIZE    (G_PRIORITY_HIGH_IDLE + 15)
00036 
00037 typedef struct _MetaUI MetaUI;
00038 
00039 typedef struct _MetaImageWindow MetaImageWindow;
00040 
00041 typedef gboolean (* MetaEventFunc) (XEvent *xevent, gpointer data);
00042 
00043 typedef enum
00044 {
00045   META_UI_DIRECTION_LTR,
00046   META_UI_DIRECTION_RTL
00047 } MetaUIDirection;
00048 
00049 void meta_ui_init (int *argc, char ***argv);
00050 
00051 Display* meta_ui_get_display (void);
00052 
00053 void meta_ui_add_event_func    (Display       *xdisplay,
00054                                 MetaEventFunc  func,
00055                                 gpointer       data);
00056 void meta_ui_remove_event_func (Display       *xdisplay,
00057                                 MetaEventFunc  func,
00058                                 gpointer       data);
00059 
00060 MetaUI* meta_ui_new (Display *xdisplay,
00061                      Screen  *screen);
00062 void    meta_ui_free (MetaUI *ui);
00063 
00064 void meta_ui_theme_get_frame_borders (MetaUI *ui,
00065                                       MetaFrameType      type,
00066                                       MetaFrameFlags     flags,
00067                                       int               *top_height,
00068                                       int               *bottom_height,
00069                                       int               *left_width,
00070                                       int               *right_width);
00071 void meta_ui_get_frame_geometry (MetaUI *ui,
00072                                  Window frame_xwindow,
00073                                  int *top_height, int *bottom_height,
00074                                  int *left_width, int *right_width);
00075 Window meta_ui_create_frame_window (MetaUI *ui,
00076                                     Display *xdisplay,
00077                                     Visual *xvisual,
00078                                     gint x,
00079                                     gint y,
00080                                     gint width,
00081                                     gint height,
00082                                     gint screen_no);
00083 void meta_ui_destroy_frame_window (MetaUI *ui,
00084                                    Window  xwindow);
00085 void meta_ui_move_resize_frame (MetaUI *ui,
00086                                 Window frame,
00087                                 int x,
00088                                 int y,
00089                                 int width,
00090                                 int height);
00091 
00092 /* GDK insists on tracking map/unmap */
00093 void meta_ui_map_frame   (MetaUI *ui,
00094                           Window  xwindow);
00095 void meta_ui_unmap_frame (MetaUI *ui,
00096                           Window  xwindow);
00097 
00098 void meta_ui_unflicker_frame_bg (MetaUI *ui,
00099                                  Window  xwindow,
00100                                  int     target_width,
00101                                  int     target_height);
00102 void meta_ui_reset_frame_bg     (MetaUI *ui,
00103                                  Window  xwindow);
00104 
00105 void meta_ui_apply_frame_shape  (MetaUI  *ui,
00106                                  Window   xwindow,
00107                                  int      new_window_width,
00108                                  int      new_window_height,
00109                                  gboolean window_has_shape);
00110 
00111 void meta_ui_queue_frame_draw (MetaUI *ui,
00112                                Window xwindow);
00113 
00114 void meta_ui_set_frame_title (MetaUI *ui,
00115                               Window xwindow,
00116                               const char *title);
00117 
00118 void meta_ui_repaint_frame (MetaUI *ui,
00119                             Window xwindow);
00120 
00121 MetaWindowMenu* meta_ui_window_menu_new   (MetaUI             *ui,
00122                                            Window              client_xwindow,
00123                                            MetaMenuOp          ops,
00124                                            MetaMenuOp          insensitive,
00125                                            unsigned long       active_workspace,
00126                                            int                 n_workspaces,
00127                                            MetaWindowMenuFunc  func,
00128                                            gpointer            data);
00129 void            meta_ui_window_menu_popup (MetaWindowMenu     *menu,
00130                                            int                 root_x,
00131                                            int                 root_y,
00132                                            int                 button,
00133                                            guint32             timestamp);
00134 void            meta_ui_window_menu_free  (MetaWindowMenu     *menu);
00135 
00136 
00137 MetaImageWindow* meta_image_window_new          (Display         *xdisplay,
00138                                                  int              screen_number,
00139                                                  int              max_width,
00140                                                  int              max_height);
00141 void             meta_image_window_free         (MetaImageWindow *iw);
00142 void             meta_image_window_set_showing  (MetaImageWindow *iw,
00143                                                  gboolean         showing);
00144 void             meta_image_window_set          (MetaImageWindow *iw,
00145                                                  GdkPixbuf       *pixbuf,
00146                                                  int              x,
00147                                                  int              y);
00148 
00149 /* FIXME these lack a display arg */
00150 GdkPixbuf* meta_gdk_pixbuf_get_from_window (GdkPixbuf   *dest,
00151                                             Window       xwindow,
00152                                             int          src_x,
00153                                             int          src_y,
00154                                             int          dest_x,
00155                                             int          dest_y,
00156                                             int          width,
00157                                             int          height);
00158 
00159 GdkPixbuf* meta_gdk_pixbuf_get_from_pixmap (GdkPixbuf   *dest,
00160                                             Pixmap       xpixmap,
00161                                             int          src_x,
00162                                             int          src_y,
00163                                             int          dest_x,
00164                                             int          dest_y,
00165                                             int          width,
00166                                             int          height);
00167 
00168 /* Used when we have a server grab and draw all over everything,
00169  * then we need to handle exposes after doing that, instead of
00170  * during it
00171  */
00172 void      meta_ui_push_delay_exposes (MetaUI *ui);
00173 void      meta_ui_pop_delay_exposes  (MetaUI *ui);
00174 
00175 GdkPixbuf* meta_ui_get_default_window_icon (MetaUI *ui);
00176 GdkPixbuf* meta_ui_get_default_mini_icon (MetaUI *ui);
00177 
00178 gboolean  meta_ui_window_should_not_cause_focus (Display *xdisplay,
00179                                                  Window   xwindow);
00180 
00181 char*     meta_text_property_to_utf8 (Display             *xdisplay,
00182                                       const XTextProperty *prop);
00183 
00184 void     meta_ui_set_current_theme (const char *name,
00185                                     gboolean    force_reload);
00186 gboolean meta_ui_have_a_theme      (void);
00187 
00188 gboolean meta_ui_parse_accelerator (const char          *accel,
00189                                     unsigned int        *keysym,
00190                                     unsigned int        *keycode,
00191                                     MetaVirtualModifier *mask);
00192 gboolean meta_ui_parse_modifier    (const char          *accel,
00193                                     MetaVirtualModifier *mask);
00194 
00195 /* Caller responsible for freeing return string of meta_ui_accelerator_name! */
00196 gchar*   meta_ui_accelerator_name  (unsigned int        keysym,
00197                                     MetaVirtualModifier mask);
00198 gboolean meta_ui_window_is_widget (MetaUI *ui,
00199                                    Window  xwindow);
00200 
00201 int      meta_ui_get_drag_threshold       (MetaUI *ui);
00202 
00203 MetaUIDirection meta_ui_get_direction (void);
00204 
00205 GdkPixbuf *meta_ui_get_pixbuf_from_pixmap (Pixmap   pmap);
00206 
00207 void meta_ui_get_fallback_icons (GdkPixbuf **fallback_icon_p,
00208                                  GdkPixbuf **fallback_mini_icon_p);
00209 
00210 #include "tabpopup.h"
00211 
00212 #endif

Generated on Sat Aug 23 22:04:18 2008 for metacity by  doxygen 1.5.5