mirror of
https://github.com/brl/mutter.git
synced 2025-02-08 09:34:10 +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;
|
||||
MetaButtonLayout button_layout;
|
||||
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);
|
||||
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);
|
||||
|
||||
client_rect = meta_window_x11_get_client_rect (window_x11);
|
||||
|
||||
meta_theme_calc_geometry (meta_theme_get_default (),
|
||||
frame->style_info,
|
||||
type,
|
||||
frame->text_height,
|
||||
flags,
|
||||
priv->client_rect.width,
|
||||
priv->client_rect.height,
|
||||
client_rect.width,
|
||||
client_rect.height,
|
||||
&button_layout,
|
||||
fgeom);
|
||||
}
|
||||
@ -1520,7 +1522,7 @@ meta_ui_frame_paint (MetaUIFrame *frame,
|
||||
int button_type = -1;
|
||||
MetaButtonLayout button_layout;
|
||||
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++)
|
||||
button_states[i] = META_BUTTON_STATE_NORMAL;
|
||||
@ -1558,13 +1560,15 @@ meta_ui_frame_paint (MetaUIFrame *frame,
|
||||
|
||||
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 (),
|
||||
frame->style_info,
|
||||
cr,
|
||||
type,
|
||||
flags,
|
||||
priv->client_rect.width,
|
||||
priv->client_rect.height,
|
||||
client_rect.width,
|
||||
client_rect.height,
|
||||
frame->text_layout,
|
||||
frame->text_height,
|
||||
&button_layout,
|
||||
|
@ -249,7 +249,7 @@ reload_net_wm_window_type (MetaWindow *window,
|
||||
{
|
||||
MetaX11Display *x11_display = window->display->x11_display;
|
||||
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)
|
||||
{
|
||||
@ -291,7 +291,7 @@ reload_icon (MetaWindow *window,
|
||||
Atom atom)
|
||||
{
|
||||
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,
|
||||
window->display->x11_display,
|
||||
@ -596,7 +596,7 @@ set_window_title (MetaWindow *window,
|
||||
const char *title)
|
||||
{
|
||||
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;
|
||||
|
||||
@ -619,7 +619,7 @@ reload_net_wm_name (MetaWindow *window,
|
||||
gboolean initial)
|
||||
{
|
||||
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)
|
||||
{
|
||||
@ -644,7 +644,7 @@ reload_wm_name (MetaWindow *window,
|
||||
gboolean initial)
|
||||
{
|
||||
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)
|
||||
{
|
||||
@ -784,7 +784,7 @@ reload_net_wm_state (MetaWindow *window,
|
||||
{
|
||||
MetaX11Display *x11_display = window->display->x11_display;
|
||||
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
|
||||
MetaWindowX11Private *priv = window_x11->priv;
|
||||
MetaWindowX11Private *priv = meta_window_x11_get_private (window_x11);
|
||||
|
||||
int i;
|
||||
|
||||
@ -1565,7 +1565,7 @@ reload_wm_hints (MetaWindow *window,
|
||||
gboolean initial)
|
||||
{
|
||||
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;
|
||||
gboolean urgent;
|
||||
|
||||
|
@ -25,27 +25,12 @@
|
||||
|
||||
#include "core/window-private.h"
|
||||
#include "x11/iconcache.h"
|
||||
#include "x11/window-x11.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
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
|
||||
{
|
||||
/* TRUE if the client forced these on */
|
||||
@ -81,6 +66,8 @@ struct _MetaWindowX11Private
|
||||
gboolean thaw_after_paint;
|
||||
};
|
||||
|
||||
MetaWindowX11Private * meta_window_x11_get_private (MetaWindowX11 *window_x11);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -73,7 +73,12 @@ meta_window_x11_maybe_focus_delayed (MetaWindow *window,
|
||||
static void
|
||||
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
|
||||
@ -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->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 "core/window-private.h"
|
||||
#include "meta/compositor.h"
|
||||
#include "meta/window.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#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))
|
||||
#define META_WINDOW_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_WINDOW_X11, MetaWindowX11Class))
|
||||
#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))
|
||||
G_DECLARE_DERIVABLE_TYPE (MetaWindowX11, meta_window_x11,
|
||||
META, WINDOW_X11, MetaWindow)
|
||||
|
||||
GType meta_window_x11_get_type (void);
|
||||
struct _MetaWindowX11Class
|
||||
{
|
||||
MetaWindowClass parent_class;
|
||||
|
||||
typedef struct _MetaWindowX11 MetaWindowX11;
|
||||
typedef struct _MetaWindowX11Class MetaWindowX11Class;
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MetaWindowX11, g_object_unref)
|
||||
void (*freeze_commits) (MetaWindow *window);
|
||||
void (*thaw_commits) (MetaWindow *window);
|
||||
gboolean (*always_update_shape) (MetaWindow *window);
|
||||
};
|
||||
|
||||
MetaWindow * meta_window_x11_new (MetaDisplay *display,
|
||||
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,
|
||||
MetaRectangle *surface_rect,
|
||||
MetaRectangle *client_rect);
|
||||
|
||||
MetaRectangle meta_window_x11_get_client_rect (MetaWindowX11 *window_x11);
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user