summaryrefslogtreecommitdiff
path: root/src/display.h
blob: e44d6d121baef3ba626880f1768027e1c2145df6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/* Metacity X display handler */

/* 
 * 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_DISPLAY_H
#define META_DISPLAY_H

#include <glib.h>
#include <X11/Xlib.h>
#include <pango/pangox.h>
#include "eventqueue.h"

typedef struct _MetaDisplay   MetaDisplay;
typedef struct _MetaFrame     MetaFrame;
typedef struct _MetaScreen    MetaScreen;
typedef struct _MetaStack     MetaStack;
typedef struct _MetaUISlave   MetaUISlave;
typedef struct _MetaWindow    MetaWindow;
typedef struct _MetaWorkspace MetaWorkspace;

#define _NET_WM_STATE_REMOVE        0    /* remove/unset property */
#define _NET_WM_STATE_ADD           1    /* add/set property */
#define _NET_WM_STATE_TOGGLE        2    /* toggle property  */

struct _MetaDisplay
{
  char *name;
  Display *xdisplay;

  Window leader_window;
  
  Atom atom_net_wm_name;
  Atom atom_wm_protocols;
  Atom atom_wm_take_focus;
  Atom atom_wm_delete_window;
  Atom atom_wm_state;
  Atom atom_net_close_window;
  Atom atom_net_wm_state;
  Atom atom_motif_wm_hints;
  Atom atom_net_wm_state_shaded;
  Atom atom_net_wm_state_maximized_horz;
  Atom atom_net_wm_state_maximized_vert;
  Atom atom_net_wm_desktop;
  Atom atom_net_number_of_desktops;
  Atom atom_wm_change_state;
  Atom atom_sm_client_id;
  Atom atom_wm_client_leader;
  Atom atom_wm_window_role;
  Atom atom_net_current_desktop;
  Atom atom_net_supporting_wm_check;
  Atom atom_net_wm_supported;
  Atom atom_net_wm_window_type;
  Atom atom_net_wm_window_type_desktop;
  Atom atom_net_wm_window_type_dock;
  Atom atom_net_wm_window_type_toolbar;
  Atom atom_net_wm_window_type_menu;
  Atom atom_net_wm_window_type_dialog;
  Atom atom_net_wm_window_type_normal;
  Atom atom_net_wm_state_modal;
  Atom atom_net_client_list;
  Atom atom_net_client_list_stacking;
  Atom atom_net_wm_state_skip_taskbar;
  Atom atom_net_wm_state_skip_pager;
  
  /* This is the actual window from focus events,
   * not the one we last set
   */
  MetaWindow *focus_window;

  GList *workspaces;
  
  /*< private-ish >*/
  MetaEventQueue *events;
  GSList *screens;
  GHashTable *window_ids;
  GSList *error_traps;
  int server_grab_count;

  /* for double click */
  int double_click_time;
  Time last_button_time;
  Window last_button_xwindow;
  int last_button_num;
  guint is_double_click : 1;
};

gboolean      meta_display_open                (const char  *name);
void          meta_display_close               (MetaDisplay *display);
MetaScreen*   meta_display_screen_for_root     (MetaDisplay *display,
                                                Window       xroot);
MetaScreen*   meta_display_screen_for_x_screen (MetaDisplay *display,
                                                Screen      *screen);
void          meta_display_grab                (MetaDisplay *display);
void          meta_display_ungrab              (MetaDisplay *display);
PangoContext* meta_display_get_pango_context   (MetaDisplay *display);
gboolean      meta_display_is_double_click     (MetaDisplay *display);

/* A given MetaWindow may have various X windows that "belong"
 * to it, such as the frame window.
 */
MetaWindow* meta_display_lookup_x_window     (MetaDisplay *display,
                                              Window       xwindow);
void        meta_display_register_x_window   (MetaDisplay *display,
                                              Window      *xwindowp,
                                              MetaWindow  *window);
void        meta_display_unregister_x_window (MetaDisplay *display,
                                              Window       xwindow);



MetaDisplay* meta_display_for_x_display  (Display     *xdisplay);
GSList*      meta_displays_list          (void);

MetaWorkspace* meta_display_get_workspace_by_index        (MetaDisplay   *display,
                                                           int            index);
MetaWorkspace* meta_display_get_workspace_by_screen_index (MetaDisplay   *display,
                                                           MetaScreen    *screen,
                                                           int            index);

#endif