core.h

Go to the documentation of this file.
00001 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
00002 
00003 /* Metacity interface used by GTK+ UI to talk to core */
00004 
00005 /* 
00006  * Copyright (C) 2001 Havoc Pennington
00007  * Copyright (C) 2005 Elijah Newren
00008  * 
00009  * This program is free software; you can redistribute it and/or
00010  * modify it under the terms of the GNU General Public License as
00011  * published by the Free Software Foundation; either version 2 of the
00012  * License, or (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful, but
00015  * WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017  * General Public License for more details.
00018  * 
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00022  * 02111-1307, USA.
00023  */
00024 
00025 #ifndef META_CORE_H
00026 #define META_CORE_H
00027 
00028 /* Don't include core headers here */
00029 #include <gdk/gdkx.h>
00030 #include "common.h"
00031 
00032 typedef enum
00033 {
00034   META_CORE_GET_END = 0,
00035   META_CORE_WINDOW_HAS_FRAME,
00036   META_CORE_GET_CLIENT_WIDTH,
00037   META_CORE_GET_CLIENT_HEIGHT,
00038   META_CORE_IS_TITLEBAR_ONSCREEN,
00039   META_CORE_GET_CLIENT_XWINDOW,
00040   META_CORE_GET_FRAME_FLAGS,
00041   META_CORE_GET_FRAME_TYPE,
00042   META_CORE_GET_MINI_ICON,
00043   META_CORE_GET_ICON,
00044   META_CORE_GET_X,
00045   META_CORE_GET_Y,
00046   META_CORE_GET_FRAME_WORKSPACE,
00047   META_CORE_GET_FRAME_X,
00048   META_CORE_GET_FRAME_Y,
00049   META_CORE_GET_FRAME_WIDTH,
00050   META_CORE_GET_FRAME_HEIGHT,
00051   META_CORE_GET_SCREEN_WIDTH,
00052   META_CORE_GET_SCREEN_HEIGHT,
00053 } MetaCoreGetType;
00054 
00055 /* General information function about the given window. Pass in a sequence of
00056  * pairs of MetaCoreGetTypes and pointers to variables; the variables will be
00057  * filled with the requested values. End the list with META_CORE_GET_END.
00058  * For example:
00059  *
00060  *   meta_core_get (my_display, my_window,
00061  *                  META_CORE_GET_X, &x,
00062  *                  META_CORE_GET_Y, &y,
00063  *                  META_CORE_GET_END);
00064  *
00065  * If the window doesn't have a frame, this will raise a meta_bug. To suppress
00066  * this behaviour, ask META_CORE_WINDOW_HAS_FRAME as the *first* question in
00067  * the list. If the window has no frame, the answer to this question will be
00068  * False, and anything else you asked will be undefined. Otherwise, the answer
00069  * will be True. The answer will necessarily be True if you ask the question
00070  * in any other position. The positions of all other questions don't matter.
00071  *
00072  * The reason for this function is that some parts of the program don't know
00073  * about MetaWindows. But they *can* see core.h. So we used to have a whole
00074  * load of functions which took a display and an X window, looked up the
00075  * relevant MetaWindow, and returned information about it. The trouble with
00076  * that is that looking up the MetaWindow is a nontrivial operation, and
00077  * consolidating the calls in this way makes (for example) frame exposes
00078  * 33% faster, according to valgrind.
00079  *
00080  * This function would perhaps be slightly better if the questions were
00081  * represented by pointers, perhaps gchar*s, because then we could take
00082  * advantage of gcc's automatic sentinel checking. On the other hand, this
00083  * immediately suggests string comparison, and that's slow.
00084  *
00085  * Another possible improvement is that core.h still has a bunch of
00086  * functions which can't be described by the formula "give a display and
00087  * an X window, get a single value" (meta_core_user_move, for example), but
00088  * which could theoretically be handled by this function if we relaxed the
00089  * requirement that all questions should have exactly one argument.
00090  */
00091 void meta_core_get (Display *xdisplay,
00092                     Window window,
00093                     ...);
00094 
00095 void meta_core_queue_frame_resize (Display *xdisplay,
00096                                    Window frame_xwindow);
00097 
00098 /* Move as a result of user operation */
00099 void meta_core_user_move    (Display *xdisplay,
00100                              Window   frame_xwindow,
00101                              int      x,
00102                              int      y);
00103 void meta_core_user_resize  (Display *xdisplay,
00104                              Window   frame_xwindow,
00105                              int      gravity,
00106                              int      width,
00107                              int      height);
00108 
00109 void meta_core_user_raise   (Display *xdisplay,
00110                              Window   frame_xwindow);
00111 void meta_core_user_lower_and_unfocus (Display *xdisplay,
00112                                        Window   frame_xwindow,
00113                                        guint32  timestamp);
00114 
00115 void meta_core_user_focus   (Display *xdisplay,
00116                              Window   frame_xwindow,
00117                              guint32  timestamp);
00118 
00119 void meta_core_minimize         (Display *xdisplay,
00120                                  Window   frame_xwindow);
00121 void meta_core_toggle_maximize  (Display *xdisplay,
00122                                  Window   frame_xwindow);
00123 void meta_core_toggle_maximize_horizontally  (Display *xdisplay,
00124                                               Window   frame_xwindow);
00125 void meta_core_toggle_maximize_vertically    (Display *xdisplay,
00126                                               Window   frame_xwindow);
00127 void meta_core_unmaximize       (Display *xdisplay,
00128                                  Window   frame_xwindow);
00129 void meta_core_maximize         (Display *xdisplay,
00130                                  Window   frame_xwindow);
00131 void meta_core_delete           (Display *xdisplay,
00132                                  Window   frame_xwindow,
00133                                  guint32  timestamp);
00134 void meta_core_unshade          (Display *xdisplay,
00135                                  Window   frame_xwindow,
00136                                  guint32  timestamp);
00137 void meta_core_shade            (Display *xdisplay,
00138                                  Window   frame_xwindow,
00139                                  guint32  timestamp);
00140 void meta_core_unstick          (Display *xdisplay,
00141                                  Window   frame_xwindow);
00142 void meta_core_stick            (Display *xdisplay,
00143                                  Window   frame_xwindow);
00144 void meta_core_unmake_above     (Display *xdisplay,
00145                                  Window   frame_xwindow);
00146 void meta_core_make_above       (Display *xdisplay,
00147                                  Window   frame_xwindow);
00148 void meta_core_change_workspace (Display *xdisplay,
00149                                  Window   frame_xwindow,
00150                                  int      new_workspace);
00151 
00152 int meta_core_get_num_workspaces (Screen  *xscreen);
00153 int meta_core_get_active_workspace (Screen *xscreen);
00154 int meta_core_get_frame_workspace (Display *xdisplay,
00155                                    Window frame_xwindow);
00156 const char* meta_core_get_workspace_name_with_index (Display *xdisplay,
00157                                                      Window xroot,
00158                                                      int    index);
00159 
00160 void meta_core_show_window_menu (Display *xdisplay,
00161                                  Window   frame_xwindow,
00162                                  int      root_x,
00163                                  int      root_y,
00164                                  int      button,
00165                                  guint32  timestamp);
00166 
00167 void meta_core_get_menu_accelerator (MetaMenuOp           menu_op,
00168                                      int                  workspace,
00169                                      unsigned int        *keysym,
00170                                      MetaVirtualModifier *modifiers);
00171 
00172 gboolean   meta_core_begin_grab_op (Display    *xdisplay,
00173                                     Window      frame_xwindow,
00174                                     MetaGrabOp  op,
00175                                     gboolean    pointer_already_grabbed,
00176                                     gboolean    frame_action,
00177                                     int         button,
00178                                     gulong      modmask,
00179                                     guint32     timestamp,
00180                                     int         root_x,
00181                                     int         root_y);
00182 void       meta_core_end_grab_op   (Display    *xdisplay,
00183                                     guint32     timestamp);
00184 MetaGrabOp meta_core_get_grab_op     (Display    *xdisplay);
00185 Window     meta_core_get_grab_frame  (Display   *xdisplay);
00186 int        meta_core_get_grab_button (Display  *xdisplay);
00187 
00188 
00189 void       meta_core_grab_buttons  (Display *xdisplay,
00190                                     Window   frame_xwindow);
00191 
00192 void       meta_core_set_screen_cursor (Display *xdisplay,
00193                                         Window   frame_on_screen,
00194                                         MetaCursor cursor);
00195 
00196 /* Used because we ignore EnterNotify when a window is unmapped that
00197  * really shouldn't cause focus changes, by comparing the event serial
00198  * of the EnterNotify and the UnmapNotify.
00199  */
00200 void meta_core_increment_event_serial (Display *display);
00201 
00202 void meta_invalidate_default_icons (void);
00203 
00204 #endif
00205 
00206 
00207 
00208 

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