mirror of
https://github.com/brl/mutter.git
synced 2024-12-25 12:32:05 +00:00
ui: Excise old frames UI
This is no longer used, in favor of the standalone frames client. Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1077 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2175>
This commit is contained in:
parent
f2237fa0c8
commit
92feea3033
@ -28,7 +28,6 @@
|
||||
#include "backends/meta-backend-private.h"
|
||||
#include "backends/meta-logical-monitor.h"
|
||||
#include "backends/meta-monitor-manager-private.h"
|
||||
#include "ui/theme-private.h"
|
||||
|
||||
#ifndef XWAYLAND_GRAB_DEFAULT_ACCESS_RULES
|
||||
# warning "XWAYLAND_GRAB_DEFAULT_ACCESS_RULES is not set"
|
||||
|
@ -42,7 +42,6 @@
|
||||
#include "core/display-private.h"
|
||||
#include "core/util-private.h"
|
||||
#include "meta/main.h"
|
||||
#include "ui/ui.h"
|
||||
#include "x11/meta-x11-display-private.h"
|
||||
|
||||
static gboolean restart_helper_started = FALSE;
|
||||
|
@ -84,7 +84,6 @@
|
||||
#include "meta/meta-enum-types.h"
|
||||
#include "meta/meta-x11-errors.h"
|
||||
#include "meta/prefs.h"
|
||||
#include "ui/ui.h"
|
||||
#include "x11/meta-x11-display-private.h"
|
||||
#include "x11/window-props.h"
|
||||
#include "x11/window-x11.h"
|
||||
|
@ -447,12 +447,6 @@ if have_x11_client
|
||||
'compositor/meta-sync-ring.h',
|
||||
'compositor/meta-window-actor-x11.c',
|
||||
'compositor/meta-window-actor-x11.h',
|
||||
'ui/frames.c',
|
||||
'ui/frames.h',
|
||||
'ui/theme.c',
|
||||
'ui/theme-private.h',
|
||||
'ui/ui.c',
|
||||
'ui/ui.h',
|
||||
'x11/atomnames.h',
|
||||
'x11/events.c',
|
||||
'x11/events.h',
|
||||
|
@ -40,7 +40,6 @@ mutter_public_headers = [
|
||||
'meta-window-shape.h',
|
||||
'meta-workspace-manager.h',
|
||||
'prefs.h',
|
||||
'theme.h',
|
||||
'types.h',
|
||||
'util.h',
|
||||
'window.h',
|
||||
|
@ -1,41 +0,0 @@
|
||||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
||||
|
||||
/* Metacity Theme Rendering */
|
||||
|
||||
/*
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef META_THEME_H
|
||||
#define META_THEME_H
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
/**
|
||||
* MetaTheme:
|
||||
*
|
||||
*/
|
||||
typedef struct _MetaTheme MetaTheme;
|
||||
|
||||
META_EXPORT
|
||||
MetaTheme* meta_theme_get_default (void);
|
||||
|
||||
META_EXPORT
|
||||
MetaTheme* meta_theme_new (void);
|
||||
|
||||
META_EXPORT
|
||||
void meta_theme_free (MetaTheme *theme);
|
||||
#endif
|
@ -31,7 +31,6 @@
|
||||
#include "meta/window.h"
|
||||
#include "core/meta-workspace-manager-private.h"
|
||||
#include "tests/meta-test-utils.h"
|
||||
#include "ui/ui.h"
|
||||
#include "wayland/meta-wayland.h"
|
||||
#include "x11/meta-x11-display-private.h"
|
||||
|
||||
@ -241,13 +240,6 @@ test_case_assert_stacking (TestCase *test,
|
||||
|
||||
if (window != NULL && window->title)
|
||||
{
|
||||
/* See comment in meta_ui_new() about why the dummy window for GTK+ theming
|
||||
* is managed as a MetaWindow.
|
||||
*/
|
||||
if (META_STACK_ID_IS_X11 (windows[i]) &&
|
||||
meta_ui_window_is_dummy (display->x11_display->ui, windows[i]))
|
||||
continue;
|
||||
|
||||
if (stack_string->len > 0)
|
||||
g_string_append_c (stack_string, ' ');
|
||||
|
||||
|
1927
src/ui/frames.c
1927
src/ui/frames.c
File diff suppressed because it is too large
Load Diff
155
src/ui/frames.h
155
src/ui/frames.h
@ -1,155 +0,0 @@
|
||||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
||||
|
||||
/* Metacity window frame manager widget */
|
||||
|
||||
/*
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef META_FRAMES_H
|
||||
#define META_FRAMES_H
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdkx.h>
|
||||
|
||||
#include "meta/common.h"
|
||||
#include "meta/types.h"
|
||||
#include "ui/theme-private.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
typedef enum
|
||||
{
|
||||
META_FRAME_CONTROL_NONE,
|
||||
META_FRAME_CONTROL_TITLE,
|
||||
META_FRAME_CONTROL_DELETE,
|
||||
META_FRAME_CONTROL_MENU,
|
||||
META_FRAME_CONTROL_MINIMIZE,
|
||||
META_FRAME_CONTROL_MAXIMIZE,
|
||||
META_FRAME_CONTROL_UNMAXIMIZE,
|
||||
META_FRAME_CONTROL_RESIZE_SE,
|
||||
META_FRAME_CONTROL_RESIZE_S,
|
||||
META_FRAME_CONTROL_RESIZE_SW,
|
||||
META_FRAME_CONTROL_RESIZE_N,
|
||||
META_FRAME_CONTROL_RESIZE_NE,
|
||||
META_FRAME_CONTROL_RESIZE_NW,
|
||||
META_FRAME_CONTROL_RESIZE_W,
|
||||
META_FRAME_CONTROL_RESIZE_E,
|
||||
META_FRAME_CONTROL_CLIENT_AREA
|
||||
} MetaFrameControl;
|
||||
|
||||
/* This is one widget that manages all the window frames
|
||||
* as subwindows.
|
||||
*/
|
||||
|
||||
#define META_TYPE_FRAMES (meta_frames_get_type ())
|
||||
#define META_FRAMES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_FRAMES, MetaFrames))
|
||||
#define META_FRAMES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_FRAMES, MetaFramesClass))
|
||||
#define META_IS_FRAMES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_FRAMES))
|
||||
#define META_IS_FRAMES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_FRAMES))
|
||||
#define META_FRAMES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_FRAMES, MetaFramesClass))
|
||||
|
||||
typedef struct _MetaFrames MetaFrames;
|
||||
typedef struct _MetaFramesClass MetaFramesClass;
|
||||
|
||||
struct _MetaUIFrame
|
||||
{
|
||||
MetaFrames *frames;
|
||||
MetaWindow *meta_window;
|
||||
Window xwindow;
|
||||
GdkWindow *window;
|
||||
MetaStyleInfo *style_info;
|
||||
MetaFrameLayout *cache_layout;
|
||||
PangoLayout *text_layout;
|
||||
int text_height;
|
||||
char *title; /* NULL once we have a layout */
|
||||
guint maybe_ignore_leave_notify : 1;
|
||||
|
||||
/* FIXME get rid of this, it can just be in the MetaFrames struct */
|
||||
MetaFrameControl prelit_control;
|
||||
MetaButtonState button_state;
|
||||
int grab_button;
|
||||
|
||||
gboolean is_frozen;
|
||||
};
|
||||
|
||||
struct _MetaFrames
|
||||
{
|
||||
GtkWindow parent_instance;
|
||||
|
||||
MetaX11Display *x11_display;
|
||||
|
||||
GHashTable *text_heights;
|
||||
|
||||
GHashTable *frames;
|
||||
|
||||
MetaStyleInfo *normal_style;
|
||||
GHashTable *style_variants;
|
||||
|
||||
GSettings *interface_settings;
|
||||
|
||||
MetaGrabOp current_grab_op;
|
||||
MetaUIFrame *grab_frame;
|
||||
guint grab_button;
|
||||
gdouble grab_x;
|
||||
gdouble grab_y;
|
||||
|
||||
ClutterEventSequence *grab_touch;
|
||||
|
||||
float last_click_x;
|
||||
float last_click_y;
|
||||
uint32_t last_click_time;
|
||||
int click_count;
|
||||
};
|
||||
|
||||
struct _MetaFramesClass
|
||||
{
|
||||
GtkWindowClass parent_class;
|
||||
|
||||
};
|
||||
|
||||
GType meta_frames_get_type (void) G_GNUC_CONST;
|
||||
|
||||
MetaFrames * meta_frames_new (MetaX11Display *x11_display);
|
||||
|
||||
MetaUIFrame * meta_frames_manage_window (MetaFrames *frames,
|
||||
MetaWindow *meta_window,
|
||||
Window xwindow,
|
||||
GdkWindow *window);
|
||||
|
||||
void meta_ui_frame_unmanage (MetaUIFrame *frame);
|
||||
|
||||
void meta_ui_frame_set_title (MetaUIFrame *frame,
|
||||
const char *title);
|
||||
|
||||
void meta_ui_frame_update_style (MetaUIFrame *frame);
|
||||
|
||||
void meta_ui_frame_get_borders (MetaUIFrame *frame,
|
||||
MetaFrameBorders *borders);
|
||||
|
||||
cairo_region_t * meta_ui_frame_get_bounds (MetaUIFrame *frame);
|
||||
|
||||
void meta_ui_frame_get_mask (MetaUIFrame *frame,
|
||||
cairo_rectangle_int_t *frame_rect,
|
||||
cairo_t *cr);
|
||||
|
||||
void meta_ui_frame_move_resize (MetaUIFrame *frame,
|
||||
int x, int y, int width, int height);
|
||||
|
||||
void meta_ui_frame_queue_draw (MetaUIFrame *frame);
|
||||
|
||||
gboolean meta_ui_frame_handle_event (MetaUIFrame *frame, const ClutterEvent *event);
|
||||
|
||||
#endif
|
@ -1,281 +0,0 @@
|
||||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
||||
|
||||
/* Metacity Theme Rendering */
|
||||
|
||||
/*
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef META_THEME_PRIVATE_H
|
||||
#define META_THEME_PRIVATE_H
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "meta/boxes.h"
|
||||
#include "meta/common.h"
|
||||
#include "meta/theme.h"
|
||||
|
||||
/**
|
||||
* MetaStyleInfo: (skip)
|
||||
*
|
||||
*/
|
||||
typedef struct _MetaStyleInfo MetaStyleInfo;
|
||||
/**
|
||||
* MetaFrameLayout: (skip)
|
||||
*
|
||||
*/
|
||||
typedef struct _MetaFrameLayout MetaFrameLayout;
|
||||
/**
|
||||
* MetaButtonSpace: (skip)
|
||||
*
|
||||
*/
|
||||
typedef struct _MetaButtonSpace MetaButtonSpace;
|
||||
/**
|
||||
* MetaFrameGeometry: (skip)
|
||||
*
|
||||
*/
|
||||
typedef struct _MetaFrameGeometry MetaFrameGeometry;
|
||||
|
||||
/**
|
||||
* Various parameters used to calculate the geometry of a frame.
|
||||
**/
|
||||
struct _MetaFrameLayout
|
||||
{
|
||||
/** Invisible border required by the theme */
|
||||
GtkBorder invisible_border;
|
||||
/** Border/padding of the entire frame */
|
||||
GtkBorder frame_border;
|
||||
/** Border/padding of the titlebar region */
|
||||
GtkBorder titlebar_border;
|
||||
/** Border/padding of titlebar buttons */
|
||||
GtkBorder button_border;
|
||||
|
||||
/** Margin of title */
|
||||
GtkBorder title_margin;
|
||||
/** Margin of titlebar buttons */
|
||||
GtkBorder button_margin;
|
||||
|
||||
/** Min size of titlebar region */
|
||||
GtkRequisition titlebar_min_size;
|
||||
/** Min size of titlebar buttons */
|
||||
GtkRequisition button_min_size;
|
||||
|
||||
/** Size of images in buttons */
|
||||
guint icon_size;
|
||||
|
||||
/** Space between titlebar elements */
|
||||
guint titlebar_spacing;
|
||||
|
||||
/** scale factor for title text */
|
||||
double title_scale;
|
||||
|
||||
/** Whether title text will be displayed */
|
||||
guint has_title : 1;
|
||||
|
||||
/** Whether we should hide the buttons */
|
||||
guint hide_buttons : 1;
|
||||
|
||||
/** Radius of the top left-hand corner; 0 if not rounded */
|
||||
guint top_left_corner_rounded_radius;
|
||||
/** Radius of the top right-hand corner; 0 if not rounded */
|
||||
guint top_right_corner_rounded_radius;
|
||||
/** Radius of the bottom left-hand corner; 0 if not rounded */
|
||||
guint bottom_left_corner_rounded_radius;
|
||||
/** Radius of the bottom right-hand corner; 0 if not rounded */
|
||||
guint bottom_right_corner_rounded_radius;
|
||||
};
|
||||
|
||||
/**
|
||||
* The computed size of a button (really just a way of tying its
|
||||
* visible and clickable areas together).
|
||||
* The reason for two different rectangles here is Fitts' law & maximized
|
||||
* windows; see bug #97703 for more details.
|
||||
*/
|
||||
struct _MetaButtonSpace
|
||||
{
|
||||
/** The screen area where the button's image is drawn */
|
||||
GdkRectangle visible;
|
||||
/** The screen area where the button can be activated by clicking */
|
||||
GdkRectangle clickable;
|
||||
};
|
||||
|
||||
/**
|
||||
* Calculated actual geometry of the frame
|
||||
*/
|
||||
struct _MetaFrameGeometry
|
||||
{
|
||||
MetaFrameBorders borders;
|
||||
|
||||
int width;
|
||||
int height;
|
||||
|
||||
GdkRectangle title_rect;
|
||||
|
||||
GtkBorder content_border;
|
||||
|
||||
/* used for a memset hack */
|
||||
#define ADDRESS_OF_BUTTON_RECTS(fgeom) (((char*)(fgeom)) + G_STRUCT_OFFSET (MetaFrameGeometry, close_rect))
|
||||
#define LENGTH_OF_BUTTON_RECTS (G_STRUCT_OFFSET (MetaFrameGeometry, menu_rect) + sizeof (MetaButtonSpace) - G_STRUCT_OFFSET (MetaFrameGeometry, close_rect))
|
||||
|
||||
/* The button rects (if changed adjust memset hack) */
|
||||
MetaButtonSpace close_rect;
|
||||
MetaButtonSpace max_rect;
|
||||
MetaButtonSpace min_rect;
|
||||
MetaButtonSpace menu_rect;
|
||||
/* End of button rects (if changed adjust memset hack) */
|
||||
|
||||
/* Saved button layout */
|
||||
MetaButtonLayout button_layout;
|
||||
int n_left_buttons;
|
||||
int n_right_buttons;
|
||||
|
||||
/* Round corners */
|
||||
guint top_left_corner_rounded_radius;
|
||||
guint top_right_corner_rounded_radius;
|
||||
guint bottom_left_corner_rounded_radius;
|
||||
guint bottom_right_corner_rounded_radius;
|
||||
};
|
||||
|
||||
typedef enum
|
||||
{
|
||||
META_BUTTON_STATE_NORMAL,
|
||||
META_BUTTON_STATE_PRESSED,
|
||||
META_BUTTON_STATE_PRELIGHT,
|
||||
META_BUTTON_STATE_LAST
|
||||
} MetaButtonState;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
META_BUTTON_TYPE_CLOSE,
|
||||
META_BUTTON_TYPE_MAXIMIZE,
|
||||
META_BUTTON_TYPE_MINIMIZE,
|
||||
META_BUTTON_TYPE_MENU,
|
||||
META_BUTTON_TYPE_LAST
|
||||
} MetaButtonType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
META_STYLE_ELEMENT_WINDOW,
|
||||
META_STYLE_ELEMENT_FRAME,
|
||||
META_STYLE_ELEMENT_TITLEBAR,
|
||||
META_STYLE_ELEMENT_TITLE,
|
||||
META_STYLE_ELEMENT_BUTTON,
|
||||
META_STYLE_ELEMENT_IMAGE,
|
||||
META_STYLE_ELEMENT_LAST
|
||||
} MetaStyleElement;
|
||||
|
||||
struct _MetaStyleInfo
|
||||
{
|
||||
int refcount;
|
||||
|
||||
GtkStyleContext *styles[META_STYLE_ELEMENT_LAST];
|
||||
};
|
||||
|
||||
/* Kinds of frame...
|
||||
*
|
||||
* normal -> focused / unfocused
|
||||
* max -> focused / unfocused
|
||||
* shaded -> focused / unfocused
|
||||
* max/shaded -> focused / unfocused
|
||||
*
|
||||
* so 4 states with 2 sub-states each, meaning 8 total
|
||||
*
|
||||
* 8 window states times 7 or 8 window types. Except some
|
||||
* window types never get a frame so that narrows it down a bit.
|
||||
*
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
META_FRAME_STATE_NORMAL,
|
||||
META_FRAME_STATE_MAXIMIZED,
|
||||
META_FRAME_STATE_TILED_LEFT,
|
||||
META_FRAME_STATE_TILED_RIGHT,
|
||||
META_FRAME_STATE_SHADED,
|
||||
META_FRAME_STATE_MAXIMIZED_AND_SHADED,
|
||||
META_FRAME_STATE_TILED_LEFT_AND_SHADED,
|
||||
META_FRAME_STATE_TILED_RIGHT_AND_SHADED,
|
||||
META_FRAME_STATE_LAST
|
||||
} MetaFrameState;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
META_FRAME_FOCUS_NO,
|
||||
META_FRAME_FOCUS_YES,
|
||||
META_FRAME_FOCUS_LAST
|
||||
} MetaFrameFocus;
|
||||
|
||||
/**
|
||||
* A theme. This is a singleton class which groups all settings from a theme
|
||||
* together.
|
||||
*/
|
||||
struct _MetaTheme
|
||||
{
|
||||
MetaFrameLayout *layouts[META_FRAME_TYPE_LAST];
|
||||
};
|
||||
|
||||
void meta_frame_layout_apply_scale (const MetaFrameLayout *layout,
|
||||
PangoFontDescription *font_desc);
|
||||
|
||||
MetaFrameLayout* meta_theme_get_frame_layout (MetaTheme *theme,
|
||||
MetaFrameType type);
|
||||
|
||||
MetaStyleInfo * meta_theme_create_style_info (GdkScreen *screen,
|
||||
const gchar *variant);
|
||||
MetaStyleInfo * meta_style_info_ref (MetaStyleInfo *style);
|
||||
void meta_style_info_unref (MetaStyleInfo *style_info);
|
||||
|
||||
void meta_style_info_set_flags (MetaStyleInfo *style_info,
|
||||
MetaFrameFlags flags);
|
||||
|
||||
PangoFontDescription * meta_style_info_create_font_desc (MetaStyleInfo *style_info);
|
||||
|
||||
void meta_theme_draw_frame (MetaTheme *theme,
|
||||
MetaStyleInfo *style_info,
|
||||
cairo_t *cr,
|
||||
MetaFrameType type,
|
||||
MetaFrameFlags flags,
|
||||
int client_width,
|
||||
int client_height,
|
||||
PangoLayout *title_layout,
|
||||
int text_height,
|
||||
const MetaButtonLayout *button_layout,
|
||||
MetaButtonState button_states[META_BUTTON_TYPE_LAST],
|
||||
cairo_surface_t *mini_icon);
|
||||
|
||||
void meta_theme_get_frame_borders (MetaTheme *theme,
|
||||
MetaStyleInfo *style_info,
|
||||
MetaFrameType type,
|
||||
int text_height,
|
||||
MetaFrameFlags flags,
|
||||
MetaFrameBorders *borders);
|
||||
|
||||
void meta_theme_calc_geometry (MetaTheme *theme,
|
||||
MetaStyleInfo *style_info,
|
||||
MetaFrameType type,
|
||||
int text_height,
|
||||
MetaFrameFlags flags,
|
||||
int client_width,
|
||||
int client_height,
|
||||
const MetaButtonLayout *button_layout,
|
||||
MetaFrameGeometry *fgeom);
|
||||
|
||||
/* random stuff */
|
||||
|
||||
int meta_pango_font_desc_get_text_height (const PangoFontDescription *font_desc,
|
||||
PangoContext *context);
|
||||
int meta_theme_get_window_scaling_factor (void);
|
||||
|
||||
#endif /* META_THEME_PRIVATE_H */
|
1358
src/ui/theme.c
1358
src/ui/theme.c
File diff suppressed because it is too large
Load Diff
240
src/ui/ui.c
240
src/ui/ui.c
@ -1,240 +0,0 @@
|
||||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
||||
|
||||
/* Mutter interface for talking to GTK+ UI module */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <cairo-xlib.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "meta/prefs.h"
|
||||
#include "meta/util.h"
|
||||
#include "ui/frames.h"
|
||||
#include "ui/theme-private.h"
|
||||
#include "ui/ui.h"
|
||||
#include "x11/meta-x11-display-private.h"
|
||||
#include "x11/meta-x11-window-control.h"
|
||||
|
||||
struct _MetaUI
|
||||
{
|
||||
Display *xdisplay;
|
||||
MetaFrames *frames;
|
||||
|
||||
/* For double-click tracking */
|
||||
gint button_click_number;
|
||||
Window button_click_window;
|
||||
int button_click_x;
|
||||
int button_click_y;
|
||||
guint32 button_click_time;
|
||||
};
|
||||
|
||||
MetaUI *
|
||||
meta_ui_new (MetaX11Display *x11_display)
|
||||
{
|
||||
MetaUI *ui;
|
||||
|
||||
if (!gtk_init_check (NULL, NULL))
|
||||
meta_fatal ("Unable to initialize GTK");
|
||||
|
||||
g_assert (x11_display->gdk_display == gdk_display_get_default ());
|
||||
|
||||
ui = g_new0 (MetaUI, 1);
|
||||
ui->xdisplay = x11_display->xdisplay;
|
||||
|
||||
ui->frames = meta_frames_new (x11_display);
|
||||
/* GTK+ needs the frame-sync protocol to work in order to properly
|
||||
* handle style changes. This means that the dummy widget we create
|
||||
* to get the style for title bars actually needs to be mapped
|
||||
* and fully tracked as a MetaWindow. Horrible, but mostly harmless -
|
||||
* the window is a 1x1 override redirect window positioned offscreen.
|
||||
*/
|
||||
gtk_widget_show (GTK_WIDGET (ui->frames));
|
||||
|
||||
g_object_set_data (G_OBJECT (x11_display->gdk_display), "meta-ui", ui);
|
||||
|
||||
return ui;
|
||||
}
|
||||
|
||||
void
|
||||
meta_ui_free (MetaUI *ui)
|
||||
{
|
||||
GdkDisplay *gdk_display;
|
||||
|
||||
gtk_widget_destroy (GTK_WIDGET (ui->frames));
|
||||
|
||||
gdk_display = gdk_x11_lookup_xdisplay (ui->xdisplay);
|
||||
g_object_set_data (G_OBJECT (gdk_display), "meta-ui", NULL);
|
||||
|
||||
g_free (ui);
|
||||
}
|
||||
|
||||
static void
|
||||
set_background_none (Display *xdisplay,
|
||||
Window xwindow)
|
||||
{
|
||||
XSetWindowAttributes attrs;
|
||||
|
||||
attrs.background_pixmap = None;
|
||||
XChangeWindowAttributes (xdisplay, xwindow,
|
||||
CWBackPixmap, &attrs);
|
||||
}
|
||||
|
||||
MetaUIFrame *
|
||||
meta_ui_create_frame (MetaUI *ui,
|
||||
Display *xdisplay,
|
||||
MetaWindow *meta_window,
|
||||
Visual *xvisual,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height,
|
||||
gulong *create_serial)
|
||||
{
|
||||
GdkDisplay *display = gdk_x11_lookup_xdisplay (xdisplay);
|
||||
GdkScreen *screen;
|
||||
GdkWindowAttr attrs;
|
||||
gint attributes_mask;
|
||||
GdkWindow *window;
|
||||
GdkVisual *visual;
|
||||
|
||||
screen = gdk_display_get_default_screen (display);
|
||||
|
||||
/* Default depth/visual handles clients with weird visuals; they can
|
||||
* always be children of the root depth/visual obviously, but
|
||||
* e.g. DRI games can't be children of a parent that has the same
|
||||
* visual as the client.
|
||||
*/
|
||||
if (!xvisual)
|
||||
visual = gdk_screen_get_system_visual (screen);
|
||||
else
|
||||
{
|
||||
visual = gdk_x11_screen_lookup_visual (screen,
|
||||
XVisualIDFromVisual (xvisual));
|
||||
}
|
||||
|
||||
attrs.title = NULL;
|
||||
|
||||
attrs.event_mask = GDK_EXPOSURE_MASK;
|
||||
attrs.x = x;
|
||||
attrs.y = y;
|
||||
attrs.wclass = GDK_INPUT_OUTPUT;
|
||||
attrs.visual = visual;
|
||||
attrs.window_type = GDK_WINDOW_CHILD;
|
||||
attrs.cursor = NULL;
|
||||
attrs.wmclass_name = NULL;
|
||||
attrs.wmclass_class = NULL;
|
||||
attrs.override_redirect = FALSE;
|
||||
|
||||
attrs.width = width;
|
||||
attrs.height = height;
|
||||
|
||||
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
|
||||
|
||||
/* We make an assumption that gdk_window_new() is going to call
|
||||
* XCreateWindow as it's first operation; this seems to be true currently
|
||||
* as long as you pass in a colormap.
|
||||
*/
|
||||
if (create_serial)
|
||||
*create_serial = XNextRequest (xdisplay);
|
||||
window =
|
||||
gdk_window_new (gdk_screen_get_root_window(screen),
|
||||
&attrs, attributes_mask);
|
||||
|
||||
gdk_window_resize (window, width, height);
|
||||
set_background_none (xdisplay, GDK_WINDOW_XID (window));
|
||||
|
||||
return meta_frames_manage_window (ui->frames, meta_window, GDK_WINDOW_XID (window), window);
|
||||
}
|
||||
|
||||
void
|
||||
meta_ui_map_frame (MetaUI *ui,
|
||||
Window xwindow)
|
||||
{
|
||||
GdkWindow *window;
|
||||
GdkDisplay *display;
|
||||
|
||||
display = gdk_x11_lookup_xdisplay (ui->xdisplay);
|
||||
window = gdk_x11_window_lookup_for_display (display, xwindow);
|
||||
|
||||
if (window)
|
||||
gdk_window_show_unraised (window);
|
||||
}
|
||||
|
||||
void
|
||||
meta_ui_unmap_frame (MetaUI *ui,
|
||||
Window xwindow)
|
||||
{
|
||||
GdkWindow *window;
|
||||
GdkDisplay *display;
|
||||
|
||||
display = gdk_x11_lookup_xdisplay (ui->xdisplay);
|
||||
window = gdk_x11_window_lookup_for_display (display, xwindow);
|
||||
|
||||
if (window)
|
||||
gdk_window_hide (window);
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_ui_window_should_not_cause_focus (Display *xdisplay,
|
||||
Window xwindow)
|
||||
{
|
||||
GdkWindow *window;
|
||||
GdkDisplay *display;
|
||||
|
||||
display = gdk_x11_lookup_xdisplay (xdisplay);
|
||||
window = gdk_x11_window_lookup_for_display (display, xwindow);
|
||||
|
||||
/* we shouldn't cause focus if we're an override redirect
|
||||
* toplevel which is not foreign
|
||||
*/
|
||||
if (window && gdk_window_get_window_type (window) == GDK_WINDOW_TEMP)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_ui_window_is_widget (MetaUI *ui,
|
||||
Window xwindow)
|
||||
{
|
||||
GdkDisplay *display;
|
||||
GdkWindow *window;
|
||||
|
||||
display = gdk_x11_lookup_xdisplay (ui->xdisplay);
|
||||
window = gdk_x11_window_lookup_for_display (display, xwindow);
|
||||
|
||||
if (window)
|
||||
{
|
||||
void *user_data = NULL;
|
||||
gdk_window_get_user_data (window, &user_data);
|
||||
return user_data != NULL && user_data != ui->frames;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_ui_window_is_dummy (MetaUI *ui,
|
||||
Window xwindow)
|
||||
{
|
||||
GdkWindow *frames_window = gtk_widget_get_window (GTK_WIDGET (ui->frames));
|
||||
return xwindow == gdk_x11_window_get_xid (frames_window);
|
||||
}
|
68
src/ui/ui.h
68
src/ui/ui.h
@ -1,68 +0,0 @@
|
||||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
||||
|
||||
/* Mutter interface for talking to GTK+ UI module */
|
||||
|
||||
/*
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef META_UI_H
|
||||
#define META_UI_H
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <cairo.h>
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
#include <glib.h>
|
||||
|
||||
#include "core/util-private.h"
|
||||
#include "meta/types.h"
|
||||
|
||||
typedef struct _MetaUI MetaUI;
|
||||
typedef struct _MetaUIFrame MetaUIFrame;
|
||||
|
||||
typedef gboolean (* MetaEventFunc) (XEvent *xevent, gpointer data);
|
||||
|
||||
MetaUI *meta_ui_new (MetaX11Display *x11_display);
|
||||
void meta_ui_free (MetaUI *ui);
|
||||
|
||||
MetaUIFrame * meta_ui_create_frame (MetaUI *ui,
|
||||
Display *xdisplay,
|
||||
MetaWindow *meta_window,
|
||||
Visual *xvisual,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height,
|
||||
gulong *create_serial);
|
||||
|
||||
/* GDK insists on tracking map/unmap */
|
||||
void meta_ui_map_frame (MetaUI *ui,
|
||||
Window xwindow);
|
||||
void meta_ui_unmap_frame (MetaUI *ui,
|
||||
Window xwindow);
|
||||
|
||||
gboolean meta_ui_window_should_not_cause_focus (Display *xdisplay,
|
||||
Window xwindow);
|
||||
|
||||
gboolean meta_ui_window_is_widget (MetaUI *ui,
|
||||
Window xwindow);
|
||||
|
||||
META_EXPORT_TEST
|
||||
gboolean meta_ui_window_is_dummy (MetaUI *ui,
|
||||
Window xwindow);
|
||||
|
||||
#endif
|
@ -36,7 +36,6 @@
|
||||
#include "meta/meta-x11-display.h"
|
||||
#include "meta-startup-notification-x11.h"
|
||||
#include "meta-x11-stack-private.h"
|
||||
#include "ui/ui.h"
|
||||
#include "x11/meta-sync-counter.h"
|
||||
|
||||
typedef struct _MetaGroupPropHooks MetaGroupPropHooks;
|
||||
@ -130,8 +129,6 @@ struct _MetaX11Display
|
||||
|
||||
GPtrArray *alarm_filters;
|
||||
|
||||
MetaUI *ui;
|
||||
|
||||
GSubprocess *frames_client;
|
||||
GCancellable *frames_client_cancellable;
|
||||
|
||||
|
@ -90,7 +90,6 @@ from The Open Group.
|
||||
#include "core/util-private.h"
|
||||
#include "core/window-private.h"
|
||||
#include "meta/meta-x11-errors.h"
|
||||
#include "ui/ui.h"
|
||||
#include "x11/meta-x11-display-private.h"
|
||||
#include "x11/mutter-Xatomtype.h"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user