frames: Punch down META_CORE_GET_FRAME_FLAGS / TYPE

These can be fetched directly off of the MetaWindow.
This commit is contained in:
Jasper St. Pierre 2015-01-01 11:47:03 -08:00
parent 12135afa5e
commit 7e66d2a484
3 changed files with 21 additions and 49 deletions

View File

@ -113,12 +113,6 @@ meta_core_get (Display *xdisplay,
case META_CORE_GET_CLIENT_HEIGHT: case META_CORE_GET_CLIENT_HEIGHT:
*((gint*)answer) = priv->client_rect.height; *((gint*)answer) = priv->client_rect.height;
break; break;
case META_CORE_GET_FRAME_FLAGS:
*((MetaFrameFlags*)answer) = meta_frame_get_flags (window->frame);
break;
case META_CORE_GET_FRAME_TYPE:
*((MetaFrameType*)answer) = meta_window_get_frame_type (window);
break;
case META_CORE_GET_MINI_ICON: case META_CORE_GET_MINI_ICON:
*((cairo_surface_t**)answer) = window->mini_icon; *((cairo_surface_t**)answer) = window->mini_icon;
break; break;

View File

@ -34,8 +34,6 @@ typedef enum
META_CORE_WINDOW_HAS_FRAME, META_CORE_WINDOW_HAS_FRAME,
META_CORE_GET_CLIENT_WIDTH, META_CORE_GET_CLIENT_WIDTH,
META_CORE_GET_CLIENT_HEIGHT, META_CORE_GET_CLIENT_HEIGHT,
META_CORE_GET_FRAME_FLAGS,
META_CORE_GET_FRAME_TYPE,
META_CORE_GET_MINI_ICON, META_CORE_GET_MINI_ICON,
META_CORE_GET_FRAME_RECT, META_CORE_GET_FRAME_RECT,
META_CORE_GET_THEME_VARIANT, META_CORE_GET_THEME_VARIANT,

View File

@ -32,6 +32,9 @@
#include <meta/prefs.h> #include <meta/prefs.h>
#include "ui.h" #include "ui.h"
#include "core/window-private.h"
#include "core/frame.h"
#include <cairo-xlib.h> #include <cairo-xlib.h>
#define DEFAULT_INNER_BUTTON_BORDER 3 #define DEFAULT_INNER_BUTTON_BORDER 3
@ -437,10 +440,11 @@ meta_ui_frame_calc_geometry (MetaUIFrame *frame,
meta_core_get (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow, meta_core_get (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow,
META_CORE_GET_CLIENT_WIDTH, &width, META_CORE_GET_CLIENT_WIDTH, &width,
META_CORE_GET_CLIENT_HEIGHT, &height, META_CORE_GET_CLIENT_HEIGHT, &height,
META_CORE_GET_FRAME_FLAGS, &flags,
META_CORE_GET_FRAME_TYPE, &type,
META_CORE_GET_END); META_CORE_GET_END);
flags = meta_frame_get_flags (frame->meta_window->frame);
type = meta_window_get_window_type (frame->meta_window);
meta_ui_frame_ensure_layout (frame, type); meta_ui_frame_ensure_layout (frame, type);
meta_prefs_get_button_layout (&button_layout); meta_prefs_get_button_layout (&button_layout);
@ -580,10 +584,8 @@ meta_ui_frame_get_borders (MetaUIFrame *frame,
MetaFrameFlags flags; MetaFrameFlags flags;
MetaFrameType type; MetaFrameType type;
meta_core_get (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow, flags = meta_frame_get_flags (frame->meta_window->frame);
META_CORE_GET_FRAME_FLAGS, &flags, type = meta_window_get_window_type (frame->meta_window);
META_CORE_GET_FRAME_TYPE, &type,
META_CORE_GET_END);
g_return_if_fail (type < META_FRAME_TYPE_LAST); g_return_if_fail (type < META_FRAME_TYPE_LAST);
@ -808,14 +810,12 @@ meta_frame_titlebar_event (MetaUIFrame *frame,
display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
flags = meta_frame_get_flags (frame->meta_window->frame);
switch (action) switch (action)
{ {
case G_DESKTOP_TITLEBAR_ACTION_TOGGLE_SHADE: case G_DESKTOP_TITLEBAR_ACTION_TOGGLE_SHADE:
{ {
meta_core_get (display, frame->xwindow,
META_CORE_GET_FRAME_FLAGS, &flags,
META_CORE_GET_END);
if (flags & META_FRAME_ALLOWS_SHADE) if (flags & META_FRAME_ALLOWS_SHADE)
{ {
if (flags & META_FRAME_SHADED) if (flags & META_FRAME_SHADED)
@ -832,10 +832,6 @@ meta_frame_titlebar_event (MetaUIFrame *frame,
case G_DESKTOP_TITLEBAR_ACTION_TOGGLE_MAXIMIZE: case G_DESKTOP_TITLEBAR_ACTION_TOGGLE_MAXIMIZE:
{ {
meta_core_get (display, frame->xwindow,
META_CORE_GET_FRAME_FLAGS, &flags,
META_CORE_GET_END);
if (flags & META_FRAME_ALLOWS_MAXIMIZE) if (flags & META_FRAME_ALLOWS_MAXIMIZE)
{ {
meta_core_toggle_maximize (display, frame->xwindow); meta_core_toggle_maximize (display, frame->xwindow);
@ -845,10 +841,6 @@ meta_frame_titlebar_event (MetaUIFrame *frame,
case G_DESKTOP_TITLEBAR_ACTION_TOGGLE_MAXIMIZE_HORIZONTALLY: case G_DESKTOP_TITLEBAR_ACTION_TOGGLE_MAXIMIZE_HORIZONTALLY:
{ {
meta_core_get (display, frame->xwindow,
META_CORE_GET_FRAME_FLAGS, &flags,
META_CORE_GET_END);
if (flags & META_FRAME_ALLOWS_MAXIMIZE) if (flags & META_FRAME_ALLOWS_MAXIMIZE)
{ {
meta_core_toggle_maximize_horizontally (display, frame->xwindow); meta_core_toggle_maximize_horizontally (display, frame->xwindow);
@ -858,10 +850,6 @@ meta_frame_titlebar_event (MetaUIFrame *frame,
case G_DESKTOP_TITLEBAR_ACTION_TOGGLE_MAXIMIZE_VERTICALLY: case G_DESKTOP_TITLEBAR_ACTION_TOGGLE_MAXIMIZE_VERTICALLY:
{ {
meta_core_get (display, frame->xwindow,
META_CORE_GET_FRAME_FLAGS, &flags,
META_CORE_GET_END);
if (flags & META_FRAME_ALLOWS_MAXIMIZE) if (flags & META_FRAME_ALLOWS_MAXIMIZE)
{ {
meta_core_toggle_maximize_vertically (display, frame->xwindow); meta_core_toggle_maximize_vertically (display, frame->xwindow);
@ -871,10 +859,6 @@ meta_frame_titlebar_event (MetaUIFrame *frame,
case G_DESKTOP_TITLEBAR_ACTION_MINIMIZE: case G_DESKTOP_TITLEBAR_ACTION_MINIMIZE:
{ {
meta_core_get (display, frame->xwindow,
META_CORE_GET_FRAME_FLAGS, &flags,
META_CORE_GET_END);
if (flags & META_FRAME_ALLOWS_MINIMIZE) if (flags & META_FRAME_ALLOWS_MINIMIZE)
{ {
meta_core_minimize (display, frame->xwindow); meta_core_minimize (display, frame->xwindow);
@ -1156,11 +1140,7 @@ meta_frames_button_press_event (GtkWidget *widget,
else if (control == META_FRAME_CONTROL_TITLE && else if (control == META_FRAME_CONTROL_TITLE &&
event->button == 1) event->button == 1)
{ {
MetaFrameFlags flags; MetaFrameFlags flags = meta_frame_get_flags (frame->meta_window->frame);
meta_core_get (display, frame->xwindow,
META_CORE_GET_FRAME_FLAGS, &flags,
META_CORE_GET_END);
if (flags & META_FRAME_ALLOWS_MOVE) if (flags & META_FRAME_ALLOWS_MOVE)
{ {
@ -1436,11 +1416,12 @@ get_visible_frame_border_region (MetaUIFrame *frame)
display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
meta_core_get (display, frame->xwindow, meta_core_get (display, frame->xwindow,
META_CORE_GET_FRAME_FLAGS, &flags,
META_CORE_GET_FRAME_TYPE, &type,
META_CORE_GET_FRAME_RECT, &frame_rect, META_CORE_GET_FRAME_RECT, &frame_rect,
META_CORE_GET_END); META_CORE_GET_END);
flags = meta_frame_get_flags (frame->meta_window->frame);
type = meta_window_get_window_type (frame->meta_window);
meta_theme_get_frame_borders (meta_theme_get_default (), frame->style_info, meta_theme_get_frame_borders (meta_theme_get_default (), frame->style_info,
type, frame->text_height, flags, type, frame->text_height, flags,
&borders); &borders);
@ -1494,10 +1475,11 @@ meta_ui_frame_get_mask (MetaUIFrame *frame,
meta_core_get (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), meta_core_get (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
frame->xwindow, frame->xwindow,
META_CORE_GET_FRAME_FLAGS, &flags,
META_CORE_GET_FRAME_RECT, &frame_rect, META_CORE_GET_FRAME_RECT, &frame_rect,
META_CORE_GET_END); META_CORE_GET_END);
flags = meta_frame_get_flags (frame->meta_window->frame);
meta_style_info_set_flags (frame->style_info, flags); meta_style_info_set_flags (frame->style_info, flags);
meta_ui_frame_get_borders (frame, &borders); meta_ui_frame_get_borders (frame, &borders);
gtk_render_background (frame->style_info->styles[META_STYLE_ELEMENT_FRAME], cr, gtk_render_background (frame->style_info->styles[META_STYLE_ELEMENT_FRAME], cr,
@ -1612,13 +1594,14 @@ meta_ui_frame_paint (MetaUIFrame *frame,
button_states[button_type] = frame->button_state; button_states[button_type] = frame->button_state;
meta_core_get (display, frame->xwindow, meta_core_get (display, frame->xwindow,
META_CORE_GET_FRAME_FLAGS, &flags,
META_CORE_GET_FRAME_TYPE, &type,
META_CORE_GET_MINI_ICON, &mini_icon, META_CORE_GET_MINI_ICON, &mini_icon,
META_CORE_GET_CLIENT_WIDTH, &w, META_CORE_GET_CLIENT_WIDTH, &w,
META_CORE_GET_CLIENT_HEIGHT, &h, META_CORE_GET_CLIENT_HEIGHT, &h,
META_CORE_GET_END); META_CORE_GET_END);
flags = meta_frame_get_flags (frame->meta_window->frame);
type = meta_window_get_window_type (frame->meta_window);
meta_ui_frame_ensure_layout (frame, type); meta_ui_frame_ensure_layout (frame, type);
meta_prefs_get_button_layout (&button_layout); meta_prefs_get_button_layout (&button_layout);
@ -1791,11 +1774,8 @@ get_control (MetaUIFrame *frame, int x, int y)
if (POINT_IN_RECT (x, y, fgeom.appmenu_rect.clickable)) if (POINT_IN_RECT (x, y, fgeom.appmenu_rect.clickable))
return META_FRAME_CONTROL_APPMENU; return META_FRAME_CONTROL_APPMENU;
meta_core_get (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), flags = meta_frame_get_flags (frame->meta_window->frame);
frame->xwindow, type = meta_window_get_window_type (frame->meta_window);
META_CORE_GET_FRAME_FLAGS, &flags,
META_CORE_GET_FRAME_TYPE, &type,
META_CORE_GET_END);
has_north_resize = (type != META_FRAME_TYPE_ATTACHED); has_north_resize = (type != META_FRAME_TYPE_ATTACHED);
has_vert = (flags & META_FRAME_ALLOWS_VERTICAL_RESIZE) != 0; has_vert = (flags & META_FRAME_ALLOWS_VERTICAL_RESIZE) != 0;