Move the installed includes to a subdir

If mutter is going to be a "real" library, then it should install its
includes so that users can do

    #include <meta/display.h>

rather than

    #include <display.h>

So rename the includedir accordingly, move src/include to src/meta,
and fix up all internal references.

There were a handful of header files in src/include that were not
installed; this appears to have been part of a plan to keep core/,
ui/, and compositor/ from looking at each others' private includes,
but that wasn't really working anyway. So move all non-installed
headers back into core/ or ui/.

https://bugzilla.gnome.org/show_bug.cgi?id=643959
This commit is contained in:
Dan Winship
2011-03-05 19:29:12 -05:00
parent bb50f65532
commit c84da3ce1b
99 changed files with 257 additions and 283 deletions

400
src/core/all-keybindings.h Normal file
View File

@ -0,0 +1,400 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* Copyright (C) 2008 Thomas Thurman
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
/**
* A list of screen keybinding information.
*
* Each action which can have a keystroke bound to it is listed below.
* To use this file, define keybind() to be a seven-argument macro (you can
* throw any of the arguments you please away), include this file,
* and then undefine the macro again.
*
* (If you aren't familiar with this technique, sometimes called "x-macros",
* see DDJ of May 2001: <http://www.ddj.com/cpp/184401387>.)
*
* This makes it possible to keep all information about all the keybindings
* in the same place. The only exception is the code to run when an action
* is actually invoked; while we *could* have put that in this file, it would
* have made debugging ridiculously difficult. Instead, each action should
* have a corresponding static function named handle_<name>() in
* keybindings.c.
*
* The arguments to keybind() are:
* 1) the name of the binding; a bareword identifier
* (it's fine if it happens to clash with a C reserved word)
* 2) the name of the function which implements it.
* Clearly we could have guessed this from the binding very often,
* but we choose to write it in full for the benefit of grep.
* 3) an integer parameter to pass to the handler
* 4) a set of boolean flags, ORed together:
* BINDING_PER_WINDOW - this is a window-based binding.
* It is only valid if there is a
* current window, and will operate in
* some way on that window.
* BINDING_REVERSES - the binding can reverse if you hold down Shift
* BINDING_IS_REVERSED - the same, but the senses are reversed from the
* handler's point of view (let me know if I should
* explain this better)
* or 0 if no flag applies.
*
* 5) a string representing the default binding.
* If this is NULL, the action is unbound by default.
* Please use NULL and not "disabled".
* 6) a short description.
* It must be marked translatable (i.e. inside "_(...)").
*
* Don't try to do XML entity escaping anywhere in the strings.
*/
#ifndef keybind
#error "keybind () must be defined when you include screen-bindings.h"
#endif
/***********************************/
#ifndef _BINDINGS_DEFINED_CONSTANTS
#define _BINDINGS_DEFINED_CONSTANTS 1
#define BINDING_PER_WINDOW 0x01
#define BINDING_REVERSES 0x02
#define BINDING_IS_REVERSED 0x04
#endif /* _BINDINGS_DEFINED_CONSTANTS */
/***********************************/
/* convenience, since in this file they must always be set together */
#define REVERSES_AND_REVERSED (BINDING_REVERSES | BINDING_IS_REVERSED)
keybind (switch_to_workspace_1, handle_switch_to_workspace, 0, 0, NULL,
_("Switch to workspace 1"))
keybind (switch_to_workspace_2, handle_switch_to_workspace, 1, 0, NULL,
_("Switch to workspace 2"))
keybind (switch_to_workspace_3, handle_switch_to_workspace, 2, 0, NULL,
_("Switch to workspace 3"))
keybind (switch_to_workspace_4, handle_switch_to_workspace, 3, 0, NULL,
_("Switch to workspace 4"))
keybind (switch_to_workspace_5, handle_switch_to_workspace, 4, 0, NULL,
_("Switch to workspace 5"))
keybind (switch_to_workspace_6, handle_switch_to_workspace, 5, 0, NULL,
_("Switch to workspace 6"))
keybind (switch_to_workspace_7, handle_switch_to_workspace, 6, 0, NULL,
_("Switch to workspace 7"))
keybind (switch_to_workspace_8, handle_switch_to_workspace, 7, 0, NULL,
_("Switch to workspace 8"))
keybind (switch_to_workspace_9, handle_switch_to_workspace, 8, 0, NULL,
_("Switch to workspace 9"))
keybind (switch_to_workspace_10, handle_switch_to_workspace, 9, 0, NULL,
_("Switch to workspace 10"))
keybind (switch_to_workspace_11, handle_switch_to_workspace, 10, 0, NULL,
_("Switch to workspace 11"))
keybind (switch_to_workspace_12, handle_switch_to_workspace, 11, 0, NULL,
_("Switch to workspace 12"))
/* META_MOTION_* are negative, and so distinct from workspace numbers,
* which are always zero or positive.
* If you make use of these constants, you will need to include workspace.h
* (which you're probably using already for other reasons anyway).
* If your definition of keybind() throws them away, you don't need to include
* workspace.h, of course.
*/
keybind (switch_to_workspace_left, handle_switch_to_workspace,
META_MOTION_LEFT, 0, "<Control><Alt>Left",
_("Switch to workspace on the left of the current workspace"))
keybind (switch_to_workspace_right, handle_switch_to_workspace,
META_MOTION_RIGHT, 0, "<Control><Alt>Right",
_("Switch to workspace on the right of the current workspace"))
keybind (switch_to_workspace_up, handle_switch_to_workspace,
META_MOTION_UP, 0, "<Control><Alt>Up",
_("Switch to workspace above the current workspace"))
keybind (switch_to_workspace_down, handle_switch_to_workspace,
META_MOTION_DOWN, 0, "<Control><Alt>Down",
_("Switch to workspace below the current workspace"))
/***********************************/
/* The ones which have inverses. These can't be bound to any keystroke
* containing Shift because Shift will invert their "backward" state.
*
* TODO: "NORMAL" and "DOCKS" should be renamed to the same name as their
* action, for obviousness.
*
* TODO: handle_switch and handle_cycle should probably really be the
* same function checking a bit in the parameter for difference.
*/
keybind (switch_group, handle_switch, META_TAB_LIST_GROUP,
BINDING_REVERSES, "<Alt>Above_Tab",
_("Move between windows of an application, using a popup window"))
keybind (switch_group_backward, handle_switch, META_TAB_LIST_GROUP,
REVERSES_AND_REVERSED, NULL,
_("Move backward between windows of an application, "
"using a popup window"))
keybind (switch_windows, handle_switch, META_TAB_LIST_NORMAL,
BINDING_REVERSES, "<Alt>Tab",
_("Move between windows, using a popup window"))
keybind (switch_windows_backward, handle_switch, META_TAB_LIST_NORMAL,
REVERSES_AND_REVERSED, NULL,
_("Move backward between windows, using a popup window"))
keybind (switch_panels, handle_switch, META_TAB_LIST_DOCKS,
BINDING_REVERSES, "<Control><Alt>Tab",
_("Move between panels and the desktop, using a popup window"))
keybind (switch_panels_backward, handle_switch, META_TAB_LIST_DOCKS,
REVERSES_AND_REVERSED, NULL,
_("Move backward between panels and the desktop, "
"using a popup window"))
keybind (cycle_group, handle_cycle, META_TAB_LIST_GROUP,
BINDING_REVERSES, "<Alt>F6",
_("Move between windows of an application immediately"))
keybind (cycle_group_backward, handle_cycle, META_TAB_LIST_GROUP,
REVERSES_AND_REVERSED, NULL,
_("Move backward between windows of an application immediately"))
keybind (cycle_windows, handle_cycle, META_TAB_LIST_NORMAL,
BINDING_REVERSES, "<Alt>Escape",
_("Move between windows immediately"))
keybind (cycle_windows_backward, handle_cycle, META_TAB_LIST_NORMAL,
REVERSES_AND_REVERSED, NULL,
_("Move backward between windows immediately"))
keybind (cycle_panels, handle_cycle, META_TAB_LIST_DOCKS,
BINDING_REVERSES, "<Control><Alt>Escape",
_("Move between panels and the desktop immediately"))
keybind (cycle_panels_backward, handle_cycle, META_TAB_LIST_DOCKS,
REVERSES_AND_REVERSED, NULL,
_("Move backward between panels and the desktop immediately"))
/***********************************/
/* These two are special pseudo-bindings that are provided for allowing
* custom handlers, but will never be bound to a key. While a tab
* grab is in effect, they are invoked for releasing the primary modifier
* or pressing some unbound key, respectively.
*/
keybind (tab_popup_select, handle_tab_popup_select, 0, 0, NULL,
"Select window from tab popup")
keybind (tab_popup_cancel, handle_tab_popup_cancel, 0, 0, NULL,
"Cancel tab popup")
/***********************************/
keybind (show_desktop, handle_show_desktop, 0, 0, "<Control><Alt>d",
_("Hide all normal windows and set focus to the desktop"))
keybind (panel_main_menu, handle_panel,
META_KEYBINDING_ACTION_PANEL_MAIN_MENU, 0, "<Alt>F1",
_("Show the panel's main menu"))
keybind (panel_run_dialog, handle_panel,
META_KEYBINDING_ACTION_PANEL_RUN_DIALOG, 0, "<Alt>F2",
_("Show the panel's \"Run Application\" dialog box"))
keybind (toggle_recording, handle_toggle_recording, 0, 0, "<Control><Shift><Alt>r",
_("Start or stop recording the session"))
/* Yes, the param is offset by one. Historical reasons. (Maybe worth fixing
* at some point.) The description is NULL here because the stanza is
* irregularly shaped in mutter.schemas.in. This will probably be fixed
* as well.
*/
keybind (run_command_1, handle_run_command, 0, 0, NULL, NULL)
keybind (run_command_2, handle_run_command, 1, 0, NULL, NULL)
keybind (run_command_3, handle_run_command, 2, 0, NULL, NULL)
keybind (run_command_4, handle_run_command, 3, 0, NULL, NULL)
keybind (run_command_5, handle_run_command, 4, 0, NULL, NULL)
keybind (run_command_6, handle_run_command, 5, 0, NULL, NULL)
keybind (run_command_7, handle_run_command, 6, 0, NULL, NULL)
keybind (run_command_8, handle_run_command, 7, 0, NULL, NULL)
keybind (run_command_9, handle_run_command, 8, 0, NULL, NULL)
keybind (run_command_10, handle_run_command, 9, 0, NULL, NULL)
keybind (run_command_11, handle_run_command, 10, 0, NULL, NULL)
keybind (run_command_12, handle_run_command, 11, 0, NULL, NULL)
keybind (run_command_13, handle_run_command, 12, 0, NULL, NULL)
keybind (run_command_14, handle_run_command, 13, 0, NULL, NULL)
keybind (run_command_15, handle_run_command, 14, 0, NULL, NULL)
keybind (run_command_16, handle_run_command, 15, 0, NULL, NULL)
keybind (run_command_17, handle_run_command, 16, 0, NULL, NULL)
keybind (run_command_18, handle_run_command, 17, 0, NULL, NULL)
keybind (run_command_19, handle_run_command, 18, 0, NULL, NULL)
keybind (run_command_20, handle_run_command, 19, 0, NULL, NULL)
keybind (run_command_21, handle_run_command, 20, 0, NULL, NULL)
keybind (run_command_22, handle_run_command, 21, 0, NULL, NULL)
keybind (run_command_23, handle_run_command, 22, 0, NULL, NULL)
keybind (run_command_24, handle_run_command, 23, 0, NULL, NULL)
keybind (run_command_25, handle_run_command, 24, 0, NULL, NULL)
keybind (run_command_26, handle_run_command, 25, 0, NULL, NULL)
keybind (run_command_27, handle_run_command, 26, 0, NULL, NULL)
keybind (run_command_28, handle_run_command, 27, 0, NULL, NULL)
keybind (run_command_29, handle_run_command, 28, 0, NULL, NULL)
keybind (run_command_30, handle_run_command, 29, 0, NULL, NULL)
keybind (run_command_31, handle_run_command, 30, 0, NULL, NULL)
keybind (run_command_32, handle_run_command, 31, 0, NULL, NULL)
keybind (run_command_screenshot, handle_run_command, 32, 0, "Print",
_("Take a screenshot"))
keybind (run_command_window_screenshot, handle_run_command, 33, 0,"<Alt>Print",
_("Take a screenshot of a window"))
keybind (run_command_terminal, handle_run_terminal, 0, 0, NULL, _("Run a terminal"))
/* No description because this is undocumented */
keybind (set_spew_mark, handle_set_spew_mark, 0, 0, NULL, NULL)
#undef REVERSES_AND_REVERSED
/************************ PER WINDOW BINDINGS ************************/
/* These take a window as an extra parameter; they have no effect
* if no window is active.
*/
keybind (activate_window_menu, handle_activate_window_menu, 0,
BINDING_PER_WINDOW, "<Alt>space",
_("Activate the window menu"))
keybind (toggle_fullscreen, handle_toggle_fullscreen, 0, BINDING_PER_WINDOW,
NULL,
_("Toggle fullscreen mode"))
keybind (toggle_maximized, handle_toggle_maximized, 0, BINDING_PER_WINDOW, "<Alt>F10",
_("Toggle maximization state"))
keybind (toggle_above, handle_toggle_above, 0, BINDING_PER_WINDOW, NULL,
_("Toggle whether a window will always be visible over other windows"))
keybind (maximize, handle_maximize, 0, BINDING_PER_WINDOW, NULL,
_("Maximize window"))
keybind (unmaximize, handle_unmaximize, 0, BINDING_PER_WINDOW, "<Alt>F5",
_("Restore window"))
keybind (toggle_shaded, handle_toggle_shaded, 0, BINDING_PER_WINDOW, NULL,
_("Toggle shaded state"))
keybind (minimize, handle_minimize, 0, BINDING_PER_WINDOW, "<Alt>F9",
_("Minimize window"))
keybind (close, handle_close, 0, BINDING_PER_WINDOW, "<Alt>F4",
_("Close window"))
keybind (begin_move, handle_begin_move, 0, BINDING_PER_WINDOW, "<Alt>F7",
_("Move window"))
keybind (begin_resize, handle_begin_resize, 0, BINDING_PER_WINDOW, "<Alt>F8",
_("Resize window"))
keybind (toggle_on_all_workspaces, handle_toggle_on_all_workspaces, 0,
BINDING_PER_WINDOW, NULL,
_("Toggle whether window is on all workspaces or just one"))
keybind (move_to_workspace_1, handle_move_to_workspace, 0, BINDING_PER_WINDOW,
NULL,
_("Move window to workspace 1"))
keybind (move_to_workspace_2, handle_move_to_workspace, 1, BINDING_PER_WINDOW,
NULL,
_("Move window to workspace 2"))
keybind (move_to_workspace_3, handle_move_to_workspace, 2, BINDING_PER_WINDOW,
NULL,
_("Move window to workspace 3"))
keybind (move_to_workspace_4, handle_move_to_workspace, 3, BINDING_PER_WINDOW,
NULL,
_("Move window to workspace 4"))
keybind (move_to_workspace_5, handle_move_to_workspace, 4, BINDING_PER_WINDOW,
NULL,
_("Move window to workspace 5"))
keybind (move_to_workspace_6, handle_move_to_workspace, 5, BINDING_PER_WINDOW,
NULL,
_("Move window to workspace 6"))
keybind (move_to_workspace_7, handle_move_to_workspace, 6, BINDING_PER_WINDOW,
NULL,
_("Move window to workspace 7"))
keybind (move_to_workspace_8, handle_move_to_workspace, 7, BINDING_PER_WINDOW,
NULL,
_("Move window to workspace 8"))
keybind (move_to_workspace_9, handle_move_to_workspace, 8, BINDING_PER_WINDOW,
NULL,
_("Move window to workspace 9"))
keybind (move_to_workspace_10, handle_move_to_workspace, 9, BINDING_PER_WINDOW,
NULL,
_("Move window to workspace 10"))
keybind (move_to_workspace_11, handle_move_to_workspace, 10, BINDING_PER_WINDOW,
NULL,
_("Move window to workspace 11"))
keybind (move_to_workspace_12, handle_move_to_workspace, 11, BINDING_PER_WINDOW,
NULL,
_("Move window to workspace 12"))
/* META_MOTION_* are negative, and so distinct from workspace numbers,
* which are always zero or positive.
* If you make use of these constants, you will need to include workspace.h
* (which you're probably using already for other reasons anyway).
* If your definition of keybind() throws them away, you don't need to include
* workspace.h, of course.
*/
keybind (move_to_workspace_left, handle_move_to_workspace,
META_MOTION_LEFT, BINDING_PER_WINDOW, "<Control><Shift><Alt>Left",
_("Move window one workspace to the left"))
keybind (move_to_workspace_right, handle_move_to_workspace,
META_MOTION_RIGHT, BINDING_PER_WINDOW, "<Control><Shift><Alt>Right",
_("Move window one workspace to the right"))
keybind (move_to_workspace_up, handle_move_to_workspace,
META_MOTION_UP, BINDING_PER_WINDOW, "<Control><Shift><Alt>Up",
_("Move window one workspace up"))
keybind (move_to_workspace_down, handle_move_to_workspace,
META_MOTION_DOWN, BINDING_PER_WINDOW, "<Control><Shift><Alt>Down",
_("Move window one workspace down"))
keybind (raise_or_lower, handle_raise_or_lower, 0, BINDING_PER_WINDOW, NULL,
_("Raise window if it's covered by another window, otherwise lower it"))
keybind (raise, handle_raise, 0, BINDING_PER_WINDOW, NULL,
_("Raise window above other windows"))
keybind (lower, handle_lower, 0, BINDING_PER_WINDOW, NULL,
_("Lower window below other windows"))
keybind (maximize_vertically, handle_maximize_vertically, 0,
BINDING_PER_WINDOW, NULL,
_("Maximize window vertically"))
keybind (maximize_horizontally, handle_maximize_horizontally, 0,
BINDING_PER_WINDOW, NULL,
_("Maximize window horizontally"))
keybind (move_to_corner_nw, handle_move_to_corner_nw, 0,
BINDING_PER_WINDOW, NULL,
_("Move window to north-west (top left) corner"))
keybind (move_to_corner_ne, handle_move_to_corner_ne, 0,
BINDING_PER_WINDOW, NULL,
_("Move window to north-east (top right) corner"))
keybind (move_to_corner_sw, handle_move_to_corner_sw, 0,
BINDING_PER_WINDOW, NULL,
_("Move window to south-west (bottom left) corner"))
keybind (move_to_corner_se, handle_move_to_corner_se, 0,
BINDING_PER_WINDOW, NULL,
_("Move window to south-east (bottom right) corner"))
keybind (move_to_side_n, handle_move_to_side_n, 0,
BINDING_PER_WINDOW, NULL,
_("Move window to north (top) side of screen"))
keybind (move_to_side_s, handle_move_to_side_s, 0,
BINDING_PER_WINDOW, NULL,
_("Move window to south (bottom) side of screen"))
keybind (move_to_side_e, handle_move_to_side_e, 0,
BINDING_PER_WINDOW, NULL,
_("Move window to east (right) side of screen"))
keybind (move_to_side_w, handle_move_to_side_w, 0,
BINDING_PER_WINDOW, NULL,
_("Move window to west (left) side of screen"))
keybind (move_to_center, handle_move_to_center, 0,
BINDING_PER_WINDOW, NULL,
_("Move window to center of screen"))
/* eof all-keybindings.h */

View File

@ -51,7 +51,7 @@
#include <config.h>
#include "bell.h"
#include "screen-private.h"
#include "prefs.h"
#include <meta/prefs.h>
#ifdef HAVE_LIBCANBERRA
#include <canberra-gtk.h>
#endif

View File

@ -36,7 +36,7 @@
#include <X11/XKBlib.h>
#endif
#include "display-private.h"
#include "frame-private.h"
#include "frame.h"
#ifdef HAVE_XKB
/**

View File

@ -25,8 +25,8 @@
#define META_BOXES_PRIVATE_H
#include <glib-object.h>
#include "common.h"
#include "boxes.h"
#include <meta/common.h>
#include <meta/boxes.h>
#define BOX_LEFT(box) ((box).x) /* Leftmost pixel of rect */
#define BOX_RIGHT(box) ((box).x + (box).width) /* One pixel past right */

View File

@ -27,7 +27,7 @@
*/
#include "boxes-private.h"
#include "util.h"
#include <meta/util.h>
#include <X11/Xutil.h> /* Just for the definition of the various gravities */
/* It would make sense to use GSlice here, but until we clean up the

View File

@ -28,7 +28,7 @@
#include "constraints.h"
#include "workspace-private.h"
#include "place.h"
#include "prefs.h"
#include <meta/prefs.h>
#include <stdlib.h>
#include <math.h>

View File

@ -25,9 +25,9 @@
#ifndef META_CONSTRAINTS_H
#define META_CONSTRAINTS_H
#include "util.h"
#include <meta/util.h>
#include "window-private.h"
#include "frame-private.h"
#include "frame.h"
typedef enum
{

View File

@ -25,10 +25,10 @@
#include <config.h>
#include "core.h"
#include "frame-private.h"
#include "frame.h"
#include "workspace-private.h"
#include "prefs.h"
#include "errors.h"
#include <meta/prefs.h>
#include <meta/errors.h>
/* Looks up the MetaWindow representing the frame of the given X window.
* Used as a helper function by a bunch of the functions below.

212
src/core/core.h Normal file
View File

@ -0,0 +1,212 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* Mutter interface used by GTK+ UI to talk to core */
/*
* Copyright (C) 2001 Havoc Pennington
* Copyright (C) 2005 Elijah Newren
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#ifndef META_CORE_H
#define META_CORE_H
/* Don't include core headers here */
#include <gdk/gdkx.h>
#include <meta/common.h>
typedef enum
{
META_CORE_GET_END = 0,
META_CORE_WINDOW_HAS_FRAME,
META_CORE_GET_CLIENT_WIDTH,
META_CORE_GET_CLIENT_HEIGHT,
META_CORE_IS_TITLEBAR_ONSCREEN,
META_CORE_GET_CLIENT_XWINDOW,
META_CORE_GET_FRAME_FLAGS,
META_CORE_GET_FRAME_TYPE,
META_CORE_GET_MINI_ICON,
META_CORE_GET_ICON,
META_CORE_GET_X,
META_CORE_GET_Y,
META_CORE_GET_FRAME_WORKSPACE,
META_CORE_GET_FRAME_X,
META_CORE_GET_FRAME_Y,
META_CORE_GET_FRAME_WIDTH,
META_CORE_GET_FRAME_HEIGHT,
META_CORE_GET_SCREEN_WIDTH,
META_CORE_GET_SCREEN_HEIGHT,
} MetaCoreGetType;
/* General information function about the given window. Pass in a sequence of
* pairs of MetaCoreGetTypes and pointers to variables; the variables will be
* filled with the requested values. End the list with META_CORE_GET_END.
* For example:
*
* meta_core_get (my_display, my_window,
* META_CORE_GET_X, &x,
* META_CORE_GET_Y, &y,
* META_CORE_GET_END);
*
* If the window doesn't have a frame, this will raise a meta_bug. To suppress
* this behaviour, ask META_CORE_WINDOW_HAS_FRAME as the *first* question in
* the list. If the window has no frame, the answer to this question will be
* False, and anything else you asked will be undefined. Otherwise, the answer
* will be True. The answer will necessarily be True if you ask the question
* in any other position. The positions of all other questions don't matter.
*
* The reason for this function is that some parts of the program don't know
* about MetaWindows. But they *can* see core.h. So we used to have a whole
* load of functions which took a display and an X window, looked up the
* relevant MetaWindow, and returned information about it. The trouble with
* that is that looking up the MetaWindow is a nontrivial operation, and
* consolidating the calls in this way makes (for example) frame exposes
* 33% faster, according to valgrind.
*
* This function would perhaps be slightly better if the questions were
* represented by pointers, perhaps gchar*s, because then we could take
* advantage of gcc's automatic sentinel checking. On the other hand, this
* immediately suggests string comparison, and that's slow.
*
* Another possible improvement is that core.h still has a bunch of
* functions which can't be described by the formula "give a display and
* an X window, get a single value" (meta_core_user_move, for example), but
* which could theoretically be handled by this function if we relaxed the
* requirement that all questions should have exactly one argument.
*/
void meta_core_get (Display *xdisplay,
Window window,
...);
void meta_core_queue_frame_resize (Display *xdisplay,
Window frame_xwindow);
/* Move as a result of user operation */
void meta_core_user_move (Display *xdisplay,
Window frame_xwindow,
int x,
int y);
void meta_core_user_resize (Display *xdisplay,
Window frame_xwindow,
int gravity,
int width,
int height);
void meta_core_user_raise (Display *xdisplay,
Window frame_xwindow);
void meta_core_user_lower_and_unfocus (Display *xdisplay,
Window frame_xwindow,
guint32 timestamp);
void meta_core_user_focus (Display *xdisplay,
Window frame_xwindow,
guint32 timestamp);
void meta_core_lower_beneath_focus_window (Display *xdisplay,
Window xwindow,
guint32 timestamp);
void meta_core_minimize (Display *xdisplay,
Window frame_xwindow);
void meta_core_toggle_maximize (Display *xdisplay,
Window frame_xwindow);
void meta_core_toggle_maximize_horizontally (Display *xdisplay,
Window frame_xwindow);
void meta_core_toggle_maximize_vertically (Display *xdisplay,
Window frame_xwindow);
void meta_core_unmaximize (Display *xdisplay,
Window frame_xwindow);
void meta_core_maximize (Display *xdisplay,
Window frame_xwindow);
void meta_core_delete (Display *xdisplay,
Window frame_xwindow,
guint32 timestamp);
void meta_core_unshade (Display *xdisplay,
Window frame_xwindow,
guint32 timestamp);
void meta_core_shade (Display *xdisplay,
Window frame_xwindow,
guint32 timestamp);
void meta_core_unstick (Display *xdisplay,
Window frame_xwindow);
void meta_core_stick (Display *xdisplay,
Window frame_xwindow);
void meta_core_unmake_above (Display *xdisplay,
Window frame_xwindow);
void meta_core_make_above (Display *xdisplay,
Window frame_xwindow);
void meta_core_change_workspace (Display *xdisplay,
Window frame_xwindow,
int new_workspace);
int meta_core_get_num_workspaces (Screen *xscreen);
int meta_core_get_active_workspace (Screen *xscreen);
int meta_core_get_frame_workspace (Display *xdisplay,
Window frame_xwindow);
const char* meta_core_get_workspace_name_with_index (Display *xdisplay,
Window xroot,
int index);
void meta_core_show_window_menu (Display *xdisplay,
Window frame_xwindow,
int root_x,
int root_y,
int button,
guint32 timestamp);
void meta_core_get_menu_accelerator (MetaMenuOp menu_op,
int workspace,
unsigned int *keysym,
MetaVirtualModifier *modifiers);
gboolean meta_core_begin_grab_op (Display *xdisplay,
Window frame_xwindow,
MetaGrabOp op,
gboolean pointer_already_grabbed,
gboolean frame_action,
int button,
gulong modmask,
guint32 timestamp,
int root_x,
int root_y);
void meta_core_end_grab_op (Display *xdisplay,
guint32 timestamp);
MetaGrabOp meta_core_get_grab_op (Display *xdisplay);
Window meta_core_get_grab_frame (Display *xdisplay);
int meta_core_get_grab_button (Display *xdisplay);
void meta_core_grab_buttons (Display *xdisplay,
Window frame_xwindow);
void meta_core_set_screen_cursor (Display *xdisplay,
Window frame_on_screen,
MetaCursor cursor);
/* Used because we ignore EnterNotify when a window is unmapped that
* really shouldn't cause focus changes, by comparing the event serial
* of the EnterNotify and the UnmapNotify.
*/
void meta_core_increment_event_serial (Display *display);
void meta_invalidate_default_icons (void);
#endif

View File

@ -25,10 +25,10 @@
#define _XOPEN_SOURCE /* for kill() */
#include <config.h>
#include "util.h"
#include <meta/util.h>
#include "window-private.h"
#include "errors.h"
#include "workspace.h"
#include <meta/errors.h>
#include <meta/workspace.h>
#include <sys/types.h>
#include <sys/wait.h>

View File

@ -34,11 +34,11 @@
#include <glib.h>
#include <X11/Xlib.h>
#include "eventqueue.h"
#include "common.h"
#include "boxes.h"
#include "display.h"
#include <meta/common.h>
#include <meta/boxes.h>
#include <meta/display.h>
#include "keybindings-private.h"
#include "prefs.h"
#include <meta/prefs.h>
#ifdef HAVE_STARTUP_NOTIFICATION
#include <libsn/sn.h>
@ -99,7 +99,7 @@ struct _MetaDisplay
* class is constructed.
*/
#define item(x) Atom atom_##x;
#include "atomnames.h"
#include <meta/atomnames.h>
#undef item
/* This is the actual window from focus events,

View File

@ -34,21 +34,21 @@
#include <config.h>
#include "display-private.h"
#include "util.h"
#include "main.h"
#include <meta/util.h>
#include <meta/main.h>
#include "screen-private.h"
#include "window-private.h"
#include "window-props.h"
#include "group-props.h"
#include "frame-private.h"
#include "errors.h"
#include "frame.h"
#include <meta/errors.h>
#include "keybindings-private.h"
#include "prefs.h"
#include <meta/prefs.h>
#include "resizepopup.h"
#include "xprops.h"
#include "workspace-private.h"
#include "bell.h"
#include "compositor.h"
#include <meta/compositor.h>
#include <X11/Xatom.h>
#include <X11/cursorfont.h>
#ifdef HAVE_SOLARIS_XINERAMA
@ -417,7 +417,7 @@ meta_display_open (void)
/* A list of all atom names, so that we can intern them in one go. */
char *atom_names[] = {
#define item(x) #x,
#include "atomnames.h"
#include <meta/atomnames.h>
#undef item
};
Atom atoms[G_N_ELEMENTS(atom_names)];
@ -490,7 +490,7 @@ meta_display_open (void)
{
int i = 0;
#define item(x) the_display->atom_##x = atoms[i++];
#include "atomnames.h"
#include <meta/atomnames.h>
#undef item
}

View File

@ -23,7 +23,7 @@
*/
#include <config.h>
#include "errors.h"
#include <meta/errors.h>
#include "display-private.h"
#include <errno.h>
#include <stdlib.h>

View File

@ -24,9 +24,9 @@
*/
#include <config.h>
#include "frame-private.h"
#include "frame.h"
#include "bell.h"
#include "errors.h"
#include <meta/errors.h>
#include "keybindings-private.h"
#include <X11/extensions/Xrender.h>

View File

@ -24,7 +24,6 @@
#ifndef META_FRAME_PRIVATE_H
#define META_FRAME_PRIVATE_H
#include "frame.h"
#include "window-private.h"
typedef struct _MetaFrameGeometry MetaFrameGeometry;
@ -68,7 +67,8 @@ void meta_window_ensure_frame (MetaWindow *window);
void meta_window_destroy_frame (MetaWindow *window);
void meta_frame_queue_draw (MetaFrame *frame);
MetaFrameFlags meta_frame_get_flags (MetaFrame *frame);
MetaFrameFlags meta_frame_get_flags (MetaFrame *frame);
Window meta_frame_get_xwindow (MetaFrame *frame);
/* These should ONLY be called from meta_window_move_resize_internal */
void meta_frame_calc_geometry (MetaFrame *frame,

View File

@ -24,7 +24,7 @@
#ifndef META_GROUP_PRIVATE_H
#define META_GROUP_PRIVATE_H
#include "group.h"
#include <meta/group.h>
struct _MetaGroup
{

View File

@ -24,7 +24,7 @@
#ifndef META_GROUP_PROPS_H
#define META_GROUP_PROPS_H
#include "group.h"
#include <meta/group.h>
#include "window-private.h"
void meta_group_reload_property (MetaGroup *group,

View File

@ -23,11 +23,11 @@
*/
#include <config.h>
#include "util.h"
#include <meta/util.h>
#include "group-private.h"
#include "group-props.h"
#include "window-private.h"
#include "window.h"
#include <meta/window.h>
static MetaGroup*
meta_group_new (MetaDisplay *display,

View File

@ -24,7 +24,7 @@
#include <config.h>
#include "iconcache.h"
#include "ui.h"
#include "errors.h"
#include <meta/errors.h>
#include <X11/Xatom.h>

View File

@ -29,7 +29,7 @@
#ifndef META_KEYBINDINGS_PRIVATE_H
#define META_KEYBINDINGS_PRIVATE_H
#include "keybindings.h"
#include <meta/keybindings.h>
void meta_display_init_keys (MetaDisplay *display);
void meta_display_shutdown_keys (MetaDisplay *display);

View File

@ -29,13 +29,13 @@
#include <config.h>
#include "keybindings-private.h"
#include "workspace-private.h"
#include "errors.h"
#include <meta/errors.h>
#include "edge-resistance.h"
#include "ui.h"
#include "frame-private.h"
#include "frame.h"
#include "place.h"
#include "prefs.h"
#include "util.h"
#include <meta/prefs.h>
#include <meta/util.h>
#include <X11/keysym.h>
#include <string.h>

View File

@ -45,14 +45,14 @@
#define _SVID_SOURCE /* for putenv() and some signal-related functions */
#include <config.h>
#include "main.h"
#include "util.h"
#include <meta/main.h>
#include <meta/util.h>
#include "display-private.h"
#include "errors.h"
#include <meta/errors.h>
#include "ui.h"
#include "session.h"
#include "prefs.h"
#include "compositor.h"
#include <meta/prefs.h>
#include <meta/compositor.h>
#include <glib-object.h>
#include <gdk/gdkx.h>

View File

@ -23,10 +23,10 @@
#include <stdlib.h>
#include "main.h"
#include "util.h"
#include <meta/main.h>
#include <meta/util.h>
#ifdef HAVE_INTROSPECTION
#include "compositor/meta-plugin-manager.h"
#include "meta-plugin-manager.h"
#endif
#include <glib.h>

View File

@ -28,8 +28,8 @@
#include "boxes-private.h"
#include "place.h"
#include "workspace.h"
#include "prefs.h"
#include <meta/workspace.h>
#include <meta/prefs.h>
#include <gdk/gdk.h>
#include <math.h>
#include <stdlib.h>

View File

@ -25,7 +25,7 @@
#define META_PLACE_H
#include "window-private.h"
#include "frame-private.h"
#include "frame.h"
void meta_window_place (MetaWindow *window,
MetaFrameGeometry *fgeom,

View File

@ -24,9 +24,10 @@
*/
#include <config.h>
#include "prefs.h"
#include <meta/prefs.h>
#include "ui.h"
#include "util.h"
#include <meta/util.h>
#include "meta-plugin-manager.h"
#ifdef HAVE_GCONF
#include <gconf/gconf-client.h>
#endif

View File

@ -34,7 +34,7 @@
#define META_SCREEN_PRIVATE_H
#include "display-private.h"
#include "screen.h"
#include <meta/screen.h>
#include <X11/Xutil.h>
#include "stack-tracker.h"
#include "ui.h"

View File

@ -28,16 +28,16 @@
#include <config.h>
#include "screen-private.h"
#include "util.h"
#include "errors.h"
#include <meta/util.h>
#include <meta/errors.h>
#include "window-private.h"
#include "frame-private.h"
#include "prefs.h"
#include "frame.h"
#include <meta/prefs.h>
#include "workspace-private.h"
#include "keybindings-private.h"
#include "stack.h"
#include "xprops.h"
#include "compositor.h"
#include <meta/compositor.h>
#include "mutter-marshal.h"
#include "mutter-enum-types.h"
@ -277,7 +277,7 @@ set_supported_hint (MetaScreen *screen)
Atom atoms[] = {
#define EWMH_ATOMS_ONLY
#define item(x) screen->display->atom_##x,
#include "atomnames.h"
#include <meta/atomnames.h>
#undef item
#undef EWMH_ATOMS_ONLY
};

View File

@ -69,10 +69,10 @@ meta_window_release_saved_state (const MetaWindowSessionInfo *info)
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include "main.h"
#include "util.h"
#include <meta/main.h>
#include <meta/util.h>
#include "display-private.h"
#include "workspace.h"
#include <meta/workspace.h>
static void ice_io_error_handler (IceConn connection);

View File

@ -23,12 +23,12 @@
#include <string.h>
#include "frame-private.h"
#include "frame.h"
#include "screen-private.h"
#include "stack-tracker.h"
#include "util.h"
#include <meta/util.h>
#include "compositor.h"
#include <meta/compositor.h>
/* The complexity here comes from resolving two competing factors:
*

View File

@ -36,7 +36,7 @@
#ifndef META_STACK_TRACKER_H
#define META_STACK_TRACKER_H
#include "screen.h"
#include <meta/screen.h>
typedef struct _MetaStackTracker MetaStackTracker;

View File

@ -29,11 +29,11 @@
#include <config.h>
#include "stack.h"
#include "window-private.h"
#include "errors.h"
#include "frame-private.h"
#include "group.h"
#include "prefs.h"
#include "workspace.h"
#include <meta/errors.h>
#include "frame.h"
#include <meta/group.h>
#include <meta/prefs.h>
#include <meta/workspace.h>
#include <X11/Xatom.h>

View File

@ -26,9 +26,9 @@
#define _POSIX_C_SOURCE 200112L /* for fdopen() */
#include <config.h>
#include "common.h"
#include "util.h"
#include "main.h"
#include <meta/common.h>
#include <meta/util.h>
#include <meta/main.h>
#include <clutter/clutter.h> /* For clutter_threads_add_repaint_func() */

View File

@ -35,10 +35,10 @@
#define META_WINDOW_PRIVATE_H
#include <config.h>
#include "compositor.h"
#include "window.h"
#include <meta/compositor.h>
#include <meta/window.h>
#include "screen-private.h"
#include "util.h"
#include <meta/util.h>
#include "stack.h"
#include "iconcache.h"
#include <X11/Xutil.h>

View File

@ -40,10 +40,10 @@
#include <config.h>
#include "window-props.h"
#include "errors.h"
#include <meta/errors.h>
#include "xprops.h"
#include "frame-private.h"
#include "group.h"
#include "frame.h"
#include <meta/group.h>
#include <X11/Xatom.h>
#include <unistd.h>
#include <string.h>

View File

@ -28,19 +28,19 @@
#include "window-private.h"
#include "boxes-private.h"
#include "edge-resistance.h"
#include "util.h"
#include "frame-private.h"
#include "errors.h"
#include <meta/util.h>
#include "frame.h"
#include <meta/errors.h>
#include "workspace-private.h"
#include "stack.h"
#include "keybindings-private.h"
#include "ui.h"
#include "place.h"
#include "session.h"
#include "prefs.h"
#include <meta/prefs.h>
#include "resizepopup.h"
#include "xprops.h"
#include "group.h"
#include <meta/group.h>
#include "window-props.h"
#include "constraints.h"
#include "mutter-enum-types.h"

View File

@ -33,7 +33,7 @@
#ifndef META_WORKSPACE_PRIVATE_H
#define META_WORKSPACE_PRIVATE_H
#include "workspace.h"
#include <meta/workspace.h>
#include "window-private.h"
struct _MetaWorkspace

View File

@ -25,13 +25,13 @@
#include <config.h>
#include "screen-private.h"
#include "workspace.h"
#include <meta/workspace.h>
#include "workspace-private.h"
#include "boxes-private.h"
#include "errors.h"
#include "prefs.h"
#include <meta/errors.h>
#include <meta/prefs.h>
#include "compositor.h"
#include <meta/compositor.h>
#include <X11/Xatom.h>
#include <string.h>

View File

@ -82,8 +82,8 @@ from The Open Group.
#include <config.h>
#include "xprops.h"
#include "errors.h"
#include "util.h"
#include <meta/errors.h>
#include <meta/util.h>
#include "async-getprop.h"
#include "ui.h"
#include "mutter-Xatomtype.h"

227
src/core/xprops.h Normal file
View File

@ -0,0 +1,227 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* Mutter X property convenience routines */
/*
* Copyright (C) 2001 Havoc Pennington
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#ifndef META_XPROPS_H
#define META_XPROPS_H
#include <config.h>
#include <meta/display.h>
#include <X11/Xutil.h>
#ifdef HAVE_XSYNC
#include <X11/extensions/sync.h>
#endif
/* Copied from Lesstif by way of GTK. Rudimentary docs can be
* found in some Motif reference guides online.
*/
typedef struct {
unsigned long flags;
unsigned long functions;
unsigned long decorations;
long input_mode;
unsigned long status;
} MotifWmHints, MwmHints;
#define MWM_HINTS_FUNCTIONS (1L << 0)
#define MWM_HINTS_DECORATIONS (1L << 1)
#define MWM_HINTS_INPUT_MODE (1L << 2)
#define MWM_HINTS_STATUS (1L << 3)
#define MWM_FUNC_ALL (1L << 0)
#define MWM_FUNC_RESIZE (1L << 1)
#define MWM_FUNC_MOVE (1L << 2)
#define MWM_FUNC_MINIMIZE (1L << 3)
#define MWM_FUNC_MAXIMIZE (1L << 4)
#define MWM_FUNC_CLOSE (1L << 5)
#define MWM_DECOR_ALL (1L << 0)
#define MWM_DECOR_BORDER (1L << 1)
#define MWM_DECOR_RESIZEH (1L << 2)
#define MWM_DECOR_TITLE (1L << 3)
#define MWM_DECOR_MENU (1L << 4)
#define MWM_DECOR_MINIMIZE (1L << 5)
#define MWM_DECOR_MAXIMIZE (1L << 6)
#define MWM_INPUT_MODELESS 0
#define MWM_INPUT_PRIMARY_APPLICATION_MODAL 1
#define MWM_INPUT_SYSTEM_MODAL 2
#define MWM_INPUT_FULL_APPLICATION_MODAL 3
#define MWM_INPUT_APPLICATION_MODAL MWM_INPUT_PRIMARY_APPLICATION_MODAL
#define MWM_TEAROFF_WINDOW (1L<<0)
/* These all return the memory from Xlib, so require an XFree()
* when they return TRUE. They return TRUE on success.
*/
gboolean meta_prop_get_atom_list (MetaDisplay *display,
Window xwindow,
Atom xatom,
Atom **atoms_p,
int *n_atoms_p);
gboolean meta_prop_get_motif_hints (MetaDisplay *display,
Window xwindow,
Atom xatom,
MotifWmHints **hints_p);
gboolean meta_prop_get_cardinal_list (MetaDisplay *display,
Window xwindow,
Atom xatom,
gulong **cardinals_p,
int *n_cardinals_p);
gboolean meta_prop_get_latin1_string (MetaDisplay *display,
Window xwindow,
Atom xatom,
char **str_p);
gboolean meta_prop_get_utf8_string (MetaDisplay *display,
Window xwindow,
Atom xatom,
char **str_p);
gboolean meta_prop_get_utf8_list (MetaDisplay *display,
Window xwindow,
Atom xatom,
char ***str_p,
int *n_str_p);
void meta_prop_set_utf8_string_hint
(MetaDisplay *display,
Window xwindow,
Atom atom,
const char *val);
gboolean meta_prop_get_window (MetaDisplay *display,
Window xwindow,
Atom xatom,
Window *window_p);
gboolean meta_prop_get_cardinal (MetaDisplay *display,
Window xwindow,
Atom xatom,
gulong *cardinal_p);
gboolean meta_prop_get_cardinal_with_atom_type (MetaDisplay *display,
Window xwindow,
Atom xatom,
Atom prop_type,
gulong *cardinal_p);
gboolean meta_prop_get_text_property (MetaDisplay *display,
Window xwindow,
Atom xatom,
char **utf8_str_p);
gboolean meta_prop_get_wm_hints (MetaDisplay *display,
Window xwindow,
Atom xatom,
XWMHints **hints_p);
gboolean meta_prop_get_class_hint (MetaDisplay *display,
Window xwindow,
Atom xatom,
XClassHint *class_hint);
gboolean meta_prop_get_size_hints (MetaDisplay *display,
Window xwindow,
Atom xatom,
XSizeHints **hints_p,
gulong *flags_p);
typedef enum
{
META_PROP_VALUE_INVALID,
META_PROP_VALUE_UTF8,
META_PROP_VALUE_STRING,
META_PROP_VALUE_STRING_AS_UTF8,
META_PROP_VALUE_MOTIF_HINTS,
META_PROP_VALUE_CARDINAL,
META_PROP_VALUE_WINDOW,
META_PROP_VALUE_CARDINAL_LIST,
META_PROP_VALUE_UTF8_LIST,
META_PROP_VALUE_ATOM_LIST,
META_PROP_VALUE_TEXT_PROPERTY, /* comes back as UTF-8 string */
META_PROP_VALUE_WM_HINTS,
META_PROP_VALUE_CLASS_HINT,
META_PROP_VALUE_SIZE_HINTS,
META_PROP_VALUE_SYNC_COUNTER /* comes back as CARDINAL */
} MetaPropValueType;
/* used to request/return/store property values */
typedef struct
{
MetaPropValueType type;
Atom atom;
Atom required_type; /* autofilled if None */
union
{
char *str;
MotifWmHints *motif_hints;
Window xwindow;
gulong cardinal;
XWMHints *wm_hints;
XClassHint class_hint;
#ifdef HAVE_XSYNC
XSyncCounter xcounter;
#endif
struct
{
XSizeHints *hints;
unsigned long flags;
} size_hints;
struct
{
gulong *cardinals;
int n_cardinals;
} cardinal_list;
struct
{
char **strings;
int n_strings;
} string_list;
struct
{
Atom *atoms;
int n_atoms;
} atom_list;
} v;
} MetaPropValue;
/* Each value has type and atom initialized. If there's an error,
* or property is unset, type comes back as INVALID;
* else type comes back as it originated, and the data
* is filled in.
*/
void meta_prop_get_values (MetaDisplay *display,
Window xwindow,
MetaPropValue *values,
int n_values);
void meta_prop_free_values (MetaPropValue *values,
int n_values);
#endif