mirror of
https://github.com/brl/mutter.git
synced 2025-02-08 17:44:09 +00:00
window/x11: Use G_DECLARE_DERIVABLE_TYPE()
This removes the MetaWindowX11::priv pointer. It is replaced with a meta_window_x11_get_private() helper function, and another method to get the client rect without going through MetaWindowX11Private. https://gitlab.gnome.org/GNOME/mutter/merge_requests/798
This commit is contained in:
parent
282aada13a
commit
0f8f607e4c
@ -417,7 +417,7 @@ meta_ui_frame_calc_geometry (MetaUIFrame *frame,
|
|||||||
MetaFrameType type;
|
MetaFrameType type;
|
||||||
MetaButtonLayout button_layout;
|
MetaButtonLayout button_layout;
|
||||||
MetaWindowX11 *window_x11 = META_WINDOW_X11 (frame->meta_window);
|
MetaWindowX11 *window_x11 = META_WINDOW_X11 (frame->meta_window);
|
||||||
MetaWindowX11Private *priv = window_x11->priv;
|
MetaRectangle client_rect;
|
||||||
|
|
||||||
flags = meta_frame_get_flags (frame->meta_window->frame);
|
flags = meta_frame_get_flags (frame->meta_window->frame);
|
||||||
type = meta_window_get_frame_type (frame->meta_window);
|
type = meta_window_get_frame_type (frame->meta_window);
|
||||||
@ -426,13 +426,15 @@ meta_ui_frame_calc_geometry (MetaUIFrame *frame,
|
|||||||
|
|
||||||
meta_prefs_get_button_layout (&button_layout);
|
meta_prefs_get_button_layout (&button_layout);
|
||||||
|
|
||||||
|
client_rect = meta_window_x11_get_client_rect (window_x11);
|
||||||
|
|
||||||
meta_theme_calc_geometry (meta_theme_get_default (),
|
meta_theme_calc_geometry (meta_theme_get_default (),
|
||||||
frame->style_info,
|
frame->style_info,
|
||||||
type,
|
type,
|
||||||
frame->text_height,
|
frame->text_height,
|
||||||
flags,
|
flags,
|
||||||
priv->client_rect.width,
|
client_rect.width,
|
||||||
priv->client_rect.height,
|
client_rect.height,
|
||||||
&button_layout,
|
&button_layout,
|
||||||
fgeom);
|
fgeom);
|
||||||
}
|
}
|
||||||
@ -1520,7 +1522,7 @@ meta_ui_frame_paint (MetaUIFrame *frame,
|
|||||||
int button_type = -1;
|
int button_type = -1;
|
||||||
MetaButtonLayout button_layout;
|
MetaButtonLayout button_layout;
|
||||||
MetaWindowX11 *window_x11 = META_WINDOW_X11 (frame->meta_window);
|
MetaWindowX11 *window_x11 = META_WINDOW_X11 (frame->meta_window);
|
||||||
MetaWindowX11Private *priv = window_x11->priv;
|
MetaRectangle client_rect;
|
||||||
|
|
||||||
for (i = 0; i < META_BUTTON_TYPE_LAST; i++)
|
for (i = 0; i < META_BUTTON_TYPE_LAST; i++)
|
||||||
button_states[i] = META_BUTTON_STATE_NORMAL;
|
button_states[i] = META_BUTTON_STATE_NORMAL;
|
||||||
@ -1558,13 +1560,15 @@ meta_ui_frame_paint (MetaUIFrame *frame,
|
|||||||
|
|
||||||
meta_prefs_get_button_layout (&button_layout);
|
meta_prefs_get_button_layout (&button_layout);
|
||||||
|
|
||||||
|
client_rect = meta_window_x11_get_client_rect (window_x11);
|
||||||
|
|
||||||
meta_theme_draw_frame (meta_theme_get_default (),
|
meta_theme_draw_frame (meta_theme_get_default (),
|
||||||
frame->style_info,
|
frame->style_info,
|
||||||
cr,
|
cr,
|
||||||
type,
|
type,
|
||||||
flags,
|
flags,
|
||||||
priv->client_rect.width,
|
client_rect.width,
|
||||||
priv->client_rect.height,
|
client_rect.height,
|
||||||
frame->text_layout,
|
frame->text_layout,
|
||||||
frame->text_height,
|
frame->text_height,
|
||||||
&button_layout,
|
&button_layout,
|
||||||
|
@ -249,7 +249,7 @@ reload_net_wm_window_type (MetaWindow *window,
|
|||||||
{
|
{
|
||||||
MetaX11Display *x11_display = window->display->x11_display;
|
MetaX11Display *x11_display = window->display->x11_display;
|
||||||
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
|
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
|
||||||
MetaWindowX11Private *priv = window_x11->priv;
|
MetaWindowX11Private *priv = meta_window_x11_get_private (window_x11);
|
||||||
|
|
||||||
if (value->type != META_PROP_VALUE_INVALID)
|
if (value->type != META_PROP_VALUE_INVALID)
|
||||||
{
|
{
|
||||||
@ -291,7 +291,7 @@ reload_icon (MetaWindow *window,
|
|||||||
Atom atom)
|
Atom atom)
|
||||||
{
|
{
|
||||||
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
|
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
|
||||||
MetaWindowX11Private *priv = window_x11->priv;
|
MetaWindowX11Private *priv = meta_window_x11_get_private (window_x11);
|
||||||
|
|
||||||
meta_icon_cache_property_changed (&priv->icon_cache,
|
meta_icon_cache_property_changed (&priv->icon_cache,
|
||||||
window->display->x11_display,
|
window->display->x11_display,
|
||||||
@ -596,7 +596,7 @@ set_window_title (MetaWindow *window,
|
|||||||
const char *title)
|
const char *title)
|
||||||
{
|
{
|
||||||
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
|
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
|
||||||
MetaWindowX11Private *priv = window_x11->priv;
|
MetaWindowX11Private *priv = meta_window_x11_get_private (window_x11);
|
||||||
|
|
||||||
char *new_title = NULL;
|
char *new_title = NULL;
|
||||||
|
|
||||||
@ -619,7 +619,7 @@ reload_net_wm_name (MetaWindow *window,
|
|||||||
gboolean initial)
|
gboolean initial)
|
||||||
{
|
{
|
||||||
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
|
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
|
||||||
MetaWindowX11Private *priv = window_x11->priv;
|
MetaWindowX11Private *priv = meta_window_x11_get_private (window_x11);
|
||||||
|
|
||||||
if (value->type != META_PROP_VALUE_INVALID)
|
if (value->type != META_PROP_VALUE_INVALID)
|
||||||
{
|
{
|
||||||
@ -644,7 +644,7 @@ reload_wm_name (MetaWindow *window,
|
|||||||
gboolean initial)
|
gboolean initial)
|
||||||
{
|
{
|
||||||
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
|
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
|
||||||
MetaWindowX11Private *priv = window_x11->priv;
|
MetaWindowX11Private *priv = meta_window_x11_get_private (window_x11);
|
||||||
|
|
||||||
if (priv->using_net_wm_name)
|
if (priv->using_net_wm_name)
|
||||||
{
|
{
|
||||||
@ -784,7 +784,7 @@ reload_net_wm_state (MetaWindow *window,
|
|||||||
{
|
{
|
||||||
MetaX11Display *x11_display = window->display->x11_display;
|
MetaX11Display *x11_display = window->display->x11_display;
|
||||||
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
|
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
|
||||||
MetaWindowX11Private *priv = window_x11->priv;
|
MetaWindowX11Private *priv = meta_window_x11_get_private (window_x11);
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -1565,7 +1565,7 @@ reload_wm_hints (MetaWindow *window,
|
|||||||
gboolean initial)
|
gboolean initial)
|
||||||
{
|
{
|
||||||
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
|
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
|
||||||
MetaWindowX11Private *priv = window_x11->priv;
|
MetaWindowX11Private *priv = meta_window_x11_get_private (window_x11);
|
||||||
Window old_group_leader;
|
Window old_group_leader;
|
||||||
gboolean urgent;
|
gboolean urgent;
|
||||||
|
|
||||||
|
@ -25,27 +25,12 @@
|
|||||||
|
|
||||||
#include "core/window-private.h"
|
#include "core/window-private.h"
|
||||||
#include "x11/iconcache.h"
|
#include "x11/iconcache.h"
|
||||||
|
#include "x11/window-x11.h"
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
typedef struct _MetaWindowX11Private MetaWindowX11Private;
|
typedef struct _MetaWindowX11Private MetaWindowX11Private;
|
||||||
|
|
||||||
struct _MetaWindowX11Class
|
|
||||||
{
|
|
||||||
MetaWindowClass parent_class;
|
|
||||||
|
|
||||||
void (*freeze_commits) (MetaWindow *window);
|
|
||||||
void (*thaw_commits) (MetaWindow *window);
|
|
||||||
gboolean (*always_update_shape) (MetaWindow *window);
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _MetaWindowX11
|
|
||||||
{
|
|
||||||
MetaWindow parent;
|
|
||||||
|
|
||||||
MetaWindowX11Private *priv;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _MetaWindowX11Private
|
struct _MetaWindowX11Private
|
||||||
{
|
{
|
||||||
/* TRUE if the client forced these on */
|
/* TRUE if the client forced these on */
|
||||||
@ -81,6 +66,8 @@ struct _MetaWindowX11Private
|
|||||||
gboolean thaw_after_paint;
|
gboolean thaw_after_paint;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
MetaWindowX11Private * meta_window_x11_get_private (MetaWindowX11 *window_x11);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -73,7 +73,12 @@ meta_window_x11_maybe_focus_delayed (MetaWindow *window,
|
|||||||
static void
|
static void
|
||||||
meta_window_x11_init (MetaWindowX11 *window_x11)
|
meta_window_x11_init (MetaWindowX11 *window_x11)
|
||||||
{
|
{
|
||||||
window_x11->priv = meta_window_x11_get_instance_private (window_x11);
|
}
|
||||||
|
|
||||||
|
MetaWindowX11Private *
|
||||||
|
meta_window_x11_get_private (MetaWindowX11 *window_x11)
|
||||||
|
{
|
||||||
|
return meta_window_x11_get_instance_private (window_x11);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -4108,3 +4113,11 @@ meta_window_x11_surface_rect_to_client_rect (MetaWindow *window,
|
|||||||
client_rect->width -= borders.total.left + borders.total.right;
|
client_rect->width -= borders.total.left + borders.total.right;
|
||||||
client_rect->height -= borders.total.top + borders.total.bottom;
|
client_rect->height -= borders.total.top + borders.total.bottom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MetaRectangle
|
||||||
|
meta_window_x11_get_client_rect (MetaWindowX11 *window_x11)
|
||||||
|
{
|
||||||
|
MetaWindowX11Private *priv = meta_window_x11_get_instance_private (window_x11);
|
||||||
|
|
||||||
|
return priv->client_rect;
|
||||||
|
}
|
||||||
|
@ -25,24 +25,24 @@
|
|||||||
|
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
|
|
||||||
|
#include "core/window-private.h"
|
||||||
#include "meta/compositor.h"
|
#include "meta/compositor.h"
|
||||||
#include "meta/window.h"
|
#include "meta/window.h"
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define META_TYPE_WINDOW_X11 (meta_window_x11_get_type())
|
#define META_TYPE_WINDOW_X11 (meta_window_x11_get_type())
|
||||||
#define META_WINDOW_X11(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_WINDOW_X11, MetaWindowX11))
|
G_DECLARE_DERIVABLE_TYPE (MetaWindowX11, meta_window_x11,
|
||||||
#define META_WINDOW_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_WINDOW_X11, MetaWindowX11Class))
|
META, WINDOW_X11, MetaWindow)
|
||||||
#define META_IS_WINDOW_X11(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_WINDOW_X11))
|
|
||||||
#define META_IS_WINDOW_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_WINDOW_X11))
|
|
||||||
#define META_WINDOW_X11_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_WINDOW_X11, MetaWindowX11Class))
|
|
||||||
|
|
||||||
GType meta_window_x11_get_type (void);
|
struct _MetaWindowX11Class
|
||||||
|
{
|
||||||
|
MetaWindowClass parent_class;
|
||||||
|
|
||||||
typedef struct _MetaWindowX11 MetaWindowX11;
|
void (*freeze_commits) (MetaWindow *window);
|
||||||
typedef struct _MetaWindowX11Class MetaWindowX11Class;
|
void (*thaw_commits) (MetaWindow *window);
|
||||||
|
gboolean (*always_update_shape) (MetaWindow *window);
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MetaWindowX11, g_object_unref)
|
};
|
||||||
|
|
||||||
MetaWindow * meta_window_x11_new (MetaDisplay *display,
|
MetaWindow * meta_window_x11_new (MetaDisplay *display,
|
||||||
Window xwindow,
|
Window xwindow,
|
||||||
@ -95,4 +95,7 @@ void meta_window_x11_surface_rect_to_frame_rect (MetaWindow *window,
|
|||||||
void meta_window_x11_surface_rect_to_client_rect (MetaWindow *window,
|
void meta_window_x11_surface_rect_to_client_rect (MetaWindow *window,
|
||||||
MetaRectangle *surface_rect,
|
MetaRectangle *surface_rect,
|
||||||
MetaRectangle *client_rect);
|
MetaRectangle *client_rect);
|
||||||
|
|
||||||
|
MetaRectangle meta_window_x11_get_client_rect (MetaWindowX11 *window_x11);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user