2001-05-30 11:36:31 -04:00
|
|
|
/* 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>
|
2001-06-02 00:14:18 -04:00
|
|
|
#include <X11/Xlib.h>
|
2001-05-30 11:36:31 -04:00
|
|
|
#include "eventqueue.h"
|
2001-07-11 02:22:00 -04:00
|
|
|
#include "common.h"
|
2001-05-30 11:36:31 -04:00
|
|
|
|
2001-06-18 02:11:53 -04:00
|
|
|
/* this doesn't really belong here, oh well. */
|
|
|
|
typedef struct _MetaRectangle MetaRectangle;
|
|
|
|
|
|
|
|
struct _MetaRectangle
|
|
|
|
{
|
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
};
|
|
|
|
|
2001-06-06 00:47:37 -04:00
|
|
|
typedef struct _MetaDisplay MetaDisplay;
|
|
|
|
typedef struct _MetaFrame MetaFrame;
|
|
|
|
typedef struct _MetaScreen MetaScreen;
|
2001-06-10 03:27:11 -04:00
|
|
|
typedef struct _MetaStack MetaStack;
|
2001-06-06 00:47:37 -04:00
|
|
|
typedef struct _MetaUISlave MetaUISlave;
|
|
|
|
typedef struct _MetaWindow MetaWindow;
|
|
|
|
typedef struct _MetaWorkspace MetaWorkspace;
|
2001-05-30 11:36:31 -04:00
|
|
|
|
2001-06-09 02:08:44 -04:00
|
|
|
#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 */
|
|
|
|
|
2001-05-30 11:36:31 -04:00
|
|
|
struct _MetaDisplay
|
|
|
|
{
|
|
|
|
char *name;
|
|
|
|
Display *xdisplay;
|
2001-05-31 23:00:01 -04:00
|
|
|
|
2001-06-09 17:58:30 -04:00
|
|
|
Window leader_window;
|
|
|
|
|
2001-06-02 00:14:18 -04:00
|
|
|
Atom atom_net_wm_name;
|
2001-06-02 21:33:27 -04:00
|
|
|
Atom atom_wm_protocols;
|
|
|
|
Atom atom_wm_take_focus;
|
|
|
|
Atom atom_wm_delete_window;
|
2001-06-06 00:47:37 -04:00
|
|
|
Atom atom_wm_state;
|
2001-06-07 01:18:10 -04:00
|
|
|
Atom atom_net_close_window;
|
2001-06-08 02:39:38 -04:00
|
|
|
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;
|
2001-06-09 01:14:43 -04:00
|
|
|
Atom atom_net_wm_desktop;
|
|
|
|
Atom atom_net_number_of_desktops;
|
2001-06-09 17:58:30 -04:00
|
|
|
Atom atom_wm_change_state;
|
|
|
|
Atom atom_sm_client_id;
|
|
|
|
Atom atom_wm_client_leader;
|
|
|
|
Atom atom_wm_window_role;
|
2001-06-09 23:17:15 -04:00
|
|
|
Atom atom_net_current_desktop;
|
|
|
|
Atom atom_net_supporting_wm_check;
|
2001-08-29 00:16:30 -04:00
|
|
|
Atom atom_net_supported;
|
2001-06-09 23:17:15 -04:00
|
|
|
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;
|
2001-06-10 03:52:35 -04:00
|
|
|
Atom atom_net_client_list;
|
|
|
|
Atom atom_net_client_list_stacking;
|
2001-06-11 01:47:51 -04:00
|
|
|
Atom atom_net_wm_state_skip_taskbar;
|
|
|
|
Atom atom_net_wm_state_skip_pager;
|
2001-06-12 20:56:08 -04:00
|
|
|
Atom atom_win_workspace;
|
2001-06-21 02:08:35 -04:00
|
|
|
Atom atom_win_layer;
|
2001-06-23 01:49:35 -04:00
|
|
|
Atom atom_win_protocols;
|
|
|
|
Atom atom_win_supporting_wm_check;
|
2001-06-23 23:18:10 -04:00
|
|
|
Atom atom_net_wm_icon_name;
|
|
|
|
Atom atom_net_wm_icon;
|
2001-08-05 12:04:52 -04:00
|
|
|
Atom atom_net_wm_icon_geometry;
|
2001-08-07 01:52:51 -04:00
|
|
|
Atom atom_utf8_string;
|
2001-08-19 21:42:44 -04:00
|
|
|
Atom atom_wm_icon_size;
|
2001-08-22 02:01:01 -04:00
|
|
|
Atom atom_kwm_win_icon;
|
2001-08-29 00:16:30 -04:00
|
|
|
Atom atom_net_wm_moveresize;
|
2001-10-07 19:06:19 -04:00
|
|
|
Atom atom_net_active_window;
|
2001-10-15 00:14:58 -04:00
|
|
|
Atom atom_metacity_restart_message;
|
2001-06-06 00:47:37 -04:00
|
|
|
|
2001-06-04 00:58:22 -04:00
|
|
|
/* This is the actual window from focus events,
|
|
|
|
* not the one we last set
|
|
|
|
*/
|
|
|
|
MetaWindow *focus_window;
|
2001-06-06 00:47:37 -04:00
|
|
|
|
2001-06-23 23:41:44 -04:00
|
|
|
/* Previous focus window */
|
|
|
|
MetaWindow *prev_focus_window;
|
|
|
|
|
2001-06-06 00:47:37 -04:00
|
|
|
GList *workspaces;
|
2001-10-14 23:39:41 -04:00
|
|
|
|
|
|
|
guint showing_desktop : 1;
|
2001-06-02 00:14:18 -04:00
|
|
|
|
2001-05-31 23:00:01 -04:00
|
|
|
/*< private-ish >*/
|
2001-05-30 11:36:31 -04:00
|
|
|
MetaEventQueue *events;
|
|
|
|
GSList *screens;
|
|
|
|
GHashTable *window_ids;
|
2001-05-30 23:30:58 -04:00
|
|
|
GSList *error_traps;
|
2001-05-31 02:42:58 -04:00
|
|
|
int server_grab_count;
|
2001-06-07 22:17:48 -04:00
|
|
|
|
|
|
|
/* for double click */
|
|
|
|
int double_click_time;
|
|
|
|
Time last_button_time;
|
|
|
|
Window last_button_xwindow;
|
|
|
|
int last_button_num;
|
|
|
|
guint is_double_click : 1;
|
2001-08-30 00:01:38 -04:00
|
|
|
|
|
|
|
unsigned long last_ignored_unmap_serial;
|
2002-01-03 18:28:19 -05:00
|
|
|
|
|
|
|
guint32 current_time;
|
2001-07-25 23:14:45 -04:00
|
|
|
|
2001-07-11 02:22:00 -04:00
|
|
|
/* current window operation */
|
|
|
|
MetaGrabOp grab_op;
|
|
|
|
MetaWindow *grab_window;
|
|
|
|
int grab_button;
|
|
|
|
int grab_root_x;
|
|
|
|
int grab_root_y;
|
|
|
|
gulong grab_mask;
|
|
|
|
guint grab_have_pointer : 1;
|
|
|
|
guint grab_have_keyboard : 1;
|
2001-07-12 01:53:56 -04:00
|
|
|
MetaRectangle grab_initial_window_pos;
|
2001-05-30 11:36:31 -04:00
|
|
|
};
|
|
|
|
|
2001-05-31 23:00:01 -04:00
|
|
|
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);
|
2001-06-07 22:17:48 -04:00
|
|
|
gboolean meta_display_is_double_click (MetaDisplay *display);
|
2001-05-31 23:00:01 -04:00
|
|
|
|
2001-05-31 02:42:58 -04:00
|
|
|
/* 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);
|
|
|
|
|
2001-06-24 04:09:10 -04:00
|
|
|
GSList* meta_display_list_windows (MetaDisplay *display);
|
2001-05-30 11:36:31 -04:00
|
|
|
|
2001-05-30 23:30:58 -04:00
|
|
|
MetaDisplay* meta_display_for_x_display (Display *xdisplay);
|
2001-05-31 02:42:58 -04:00
|
|
|
GSList* meta_displays_list (void);
|
2001-05-30 11:36:31 -04:00
|
|
|
|
2001-06-06 00:47:37 -04:00
|
|
|
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);
|
2001-07-25 23:14:45 -04:00
|
|
|
|
|
|
|
Cursor meta_display_create_x_cursor (MetaDisplay *display,
|
|
|
|
MetaCursor cursor);
|
|
|
|
|
2001-07-11 02:22:00 -04:00
|
|
|
gboolean meta_display_begin_grab_op (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
|
|
|
MetaGrabOp op,
|
|
|
|
gboolean pointer_already_grabbed,
|
|
|
|
int button,
|
|
|
|
gulong modmask,
|
|
|
|
Time timestamp,
|
|
|
|
int root_x,
|
|
|
|
int root_y);
|
|
|
|
void meta_display_end_grab_op (MetaDisplay *display,
|
|
|
|
Time timestamp);
|
|
|
|
|
2001-07-25 23:14:45 -04:00
|
|
|
void meta_display_grab_window_buttons (MetaDisplay *display,
|
|
|
|
Window xwindow);
|
|
|
|
void meta_display_ungrab_window_buttons (MetaDisplay *display,
|
|
|
|
Window xwindow);
|
2001-07-11 02:22:00 -04:00
|
|
|
|
2001-12-10 23:03:58 -05:00
|
|
|
void meta_display_grab_focus_window_button (MetaDisplay *display,
|
|
|
|
Window xwindow);
|
|
|
|
void meta_display_ungrab_focus_window_button (MetaDisplay *display,
|
|
|
|
Window xwindow);
|
2001-12-10 02:48:21 -05:00
|
|
|
|
2001-08-30 00:01:38 -04:00
|
|
|
/* make a request to ensure the event serial has changed */
|
|
|
|
void meta_display_increment_event_serial (MetaDisplay *display);
|
2001-06-06 00:47:37 -04:00
|
|
|
|
2001-10-07 19:06:19 -04:00
|
|
|
void meta_display_update_active_window_hint (MetaDisplay *display);
|
|
|
|
|
2001-10-14 23:39:41 -04:00
|
|
|
/* Show/hide the desktop (temporarily hide all windows) */
|
|
|
|
void meta_display_show_desktop (MetaDisplay *display);
|
|
|
|
void meta_display_unshow_desktop (MetaDisplay *display);
|
|
|
|
|
2002-01-03 18:28:19 -05:00
|
|
|
guint32 meta_display_get_current_time (MetaDisplay *display);
|
|
|
|
|
2001-05-30 11:36:31 -04:00
|
|
|
#endif
|