Start moving X11-specific code to window-x11.c

The goal here is to make MetaWindow represent a toplevel, managed window,
regardless of if it's X11 or Wayland, and build an abstraction layer up.
Right now, most of the X11 code is in core/ and the wayland code in wayland/,
but in the future, I want to move a lot of the X11 code to a new toplevel, x11/.
This commit is contained in:
Jasper St. Pierre 2014-01-23 16:33:53 -05:00
parent ff89f1e271
commit f7097e6f66
7 changed files with 1223 additions and 1141 deletions

View File

@ -163,6 +163,8 @@ libmutter_wayland_la_SOURCES = \
core/util-private.h \ core/util-private.h \
core/window-props.c \ core/window-props.c \
core/window-props.h \ core/window-props.h \
core/window-x11.c \
core/window-x11.h \
core/window.c \ core/window.c \
core/window-private.h \ core/window-private.h \
meta/window.h \ meta/window.h \

View File

@ -36,6 +36,7 @@
#include <meta/main.h> #include <meta/main.h>
#include "screen-private.h" #include "screen-private.h"
#include "window-private.h" #include "window-private.h"
#include "window-x11.h"
#include "window-props.h" #include "window-props.h"
#include "group-props.h" #include "group-props.h"
#include "frame.h" #include "frame.h"
@ -1581,7 +1582,7 @@ handle_net_restack_window (MetaDisplay* display,
* *
* Also, unconditionally following these is REALLY stupid--we should * Also, unconditionally following these is REALLY stupid--we should
* combine this code with the stuff in * combine this code with the stuff in
* meta_window_configure_request() which is smart about whether to * meta_window_x11_configure_request() which is smart about whether to
* follow the request or do something else (though not smart enough * follow the request or do something else (though not smart enough
* and is also too stupid to handle the sibling stuff). * and is also too stupid to handle the sibling stuff).
*/ */
@ -2692,9 +2693,9 @@ handle_other_xevent (MetaDisplay *display,
XShapeEvent *sev = (XShapeEvent*) event; XShapeEvent *sev = (XShapeEvent*) event;
if (sev->kind == ShapeBounding) if (sev->kind == ShapeBounding)
meta_window_update_shape_region_x11 (window); meta_window_x11_update_shape_region (window);
else if (sev->kind == ShapeInput) else if (sev->kind == ShapeInput)
meta_window_update_input_region_x11 (window); meta_window_x11_update_input_region (window);
} }
else else
{ {
@ -2903,7 +2904,7 @@ handle_other_xevent (MetaDisplay *display,
else else
{ {
if (!frame_was_receiver) if (!frame_was_receiver)
meta_window_configure_request (window, event); meta_window_x11_configure_request (window, event);
} }
break; break;
case GravityNotify: case GravityNotify:
@ -2920,9 +2921,9 @@ handle_other_xevent (MetaDisplay *display,
MetaScreen *screen; MetaScreen *screen;
if (window && !frame_was_receiver) if (window && !frame_was_receiver)
meta_window_property_notify (window, event); meta_window_x11_property_notify (window, event);
else if (property_for_window && !frame_was_receiver) else if (property_for_window && !frame_was_receiver)
meta_window_property_notify (property_for_window, event); meta_window_x11_property_notify (property_for_window, event);
group = meta_display_lookup_group (display, group = meta_display_lookup_group (display,
event->xproperty.window); event->xproperty.window);
@ -2993,7 +2994,7 @@ handle_other_xevent (MetaDisplay *display,
if (window) if (window)
{ {
if (!frame_was_receiver) if (!frame_was_receiver)
meta_window_client_message (window, event); meta_window_x11_client_message (window, event);
} }
else else
{ {

View File

@ -615,12 +615,6 @@ void meta_window_move_resize_wayland (MetaWindow *window,
int height, int height,
int dx, int dx,
int dy); int dy);
gboolean meta_window_configure_request (MetaWindow *window,
XEvent *event);
gboolean meta_window_property_notify (MetaWindow *window,
XEvent *event);
gboolean meta_window_client_message (MetaWindow *window,
XEvent *event);
void meta_window_set_focused_internal (MetaWindow *window, void meta_window_set_focused_internal (MetaWindow *window,
gboolean focused); gboolean focused);
@ -697,8 +691,6 @@ void meta_window_set_user_time (MetaWindow *window,
void meta_window_update_icon_now (MetaWindow *window); void meta_window_update_icon_now (MetaWindow *window);
void meta_window_update_role (MetaWindow *window);
void meta_window_update_net_wm_type (MetaWindow *window);
void meta_window_update_for_monitors_changed (MetaWindow *window); void meta_window_update_for_monitors_changed (MetaWindow *window);
void meta_window_update_on_all_workspaces (MetaWindow *window); void meta_window_update_on_all_workspaces (MetaWindow *window);
@ -712,10 +704,6 @@ void meta_window_compute_tile_match (MetaWindow *window);
gboolean meta_window_updates_are_frozen (MetaWindow *window); gboolean meta_window_updates_are_frozen (MetaWindow *window);
void meta_window_update_opaque_region_x11 (MetaWindow *window);
void meta_window_update_input_region_x11 (MetaWindow *window);
void meta_window_update_shape_region_x11 (MetaWindow *window);
void meta_window_set_title (MetaWindow *window, void meta_window_set_title (MetaWindow *window,
const char *title); const char *title);
void meta_window_set_wm_class (MetaWindow *window, void meta_window_set_wm_class (MetaWindow *window,
@ -756,4 +744,9 @@ void meta_window_pong (MetaWindow *window,
guint32 timestamp); guint32 timestamp);
Window meta_window_get_toplevel_xwindow (MetaWindow *window); Window meta_window_get_toplevel_xwindow (MetaWindow *window);
void meta_window_activate_full (MetaWindow *window,
guint32 timestamp,
MetaClientType source_indication,
MetaWorkspace *workspace);
#endif #endif

View File

@ -39,6 +39,7 @@
#include <config.h> #include <config.h>
#include "window-props.h" #include "window-props.h"
#include "window-x11.h"
#include <meta/errors.h> #include <meta/errors.h>
#include "xprops.h" #include "xprops.h"
#include "frame.h" #include "frame.h"
@ -229,7 +230,7 @@ reload_net_wm_window_type (MetaWindow *window,
MetaPropValue *value, MetaPropValue *value,
gboolean initial) gboolean initial)
{ {
meta_window_update_net_wm_type (window); meta_window_x11_update_net_wm_type (window);
} }
static void static void
@ -333,7 +334,7 @@ reload_wm_window_role (MetaWindow *window,
MetaPropValue *value, MetaPropValue *value,
gboolean initial) gboolean initial)
{ {
meta_window_update_role (window); meta_window_x11_update_role (window);
} }
static void static void
@ -558,7 +559,7 @@ reload_opaque_region (MetaWindow *window,
MetaPropValue *value, MetaPropValue *value,
gboolean initial) gboolean initial)
{ {
meta_window_update_opaque_region_x11 (window); meta_window_x11_update_opaque_region (window);
} }
static void static void

1148
src/core/window-x11.c Normal file

File diff suppressed because it is too large Load Diff

44
src/core/window-x11.h Normal file
View File

@ -0,0 +1,44 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* Copyright (C) 2001 Havoc Pennington
* Copyright (C) 2002 Red Hat, Inc.
* Copyright (C) 2003, 2004 Rob Adams
* Copyright (C) 2004-2006 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef META_WINDOW_X11_H
#define META_WINDOW_X11_H
#include <meta/window.h>
#include <X11/Xlib.h>
void meta_window_x11_set_net_wm_state (MetaWindow *window);
void meta_window_x11_update_role (MetaWindow *window);
void meta_window_x11_update_net_wm_type (MetaWindow *window);
void meta_window_x11_update_opaque_region (MetaWindow *window);
void meta_window_x11_update_input_region (MetaWindow *window);
void meta_window_x11_update_shape_region (MetaWindow *window);
gboolean meta_window_x11_configure_request (MetaWindow *window,
XEvent *event);
gboolean meta_window_x11_property_notify (MetaWindow *window,
XEvent *event);
gboolean meta_window_x11_client_message (MetaWindow *window,
XEvent *event);
#endif

File diff suppressed because it is too large Load Diff