2006-10-01 22:30:10 +00:00
|
|
|
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
|
|
|
|
2001-06-12 04:38:24 +00:00
|
|
|
/* Metacity window frame manager widget */
|
|
|
|
|
2014-05-02 09:34:02 -04:00
|
|
|
/*
|
2001-06-12 04:38:24 +00:00
|
|
|
* Copyright (C) 2001 Havoc Pennington
|
2014-05-02 09:34:02 -04:00
|
|
|
*
|
2001-06-12 04:38:24 +00:00
|
|
|
* 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.
|
2014-05-02 09:34:02 -04:00
|
|
|
*
|
2001-06-12 04:38:24 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
2014-01-12 08:42:06 +07:00
|
|
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
2001-06-12 04:38:24 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef META_FRAMES_H
|
|
|
|
#define META_FRAMES_H
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
2001-06-15 04:33:21 +00:00
|
|
|
#include <gdk/gdkx.h>
|
2018-07-10 10:36:24 +02:00
|
|
|
|
2019-10-15 12:56:26 +02:00
|
|
|
#include "core/main-private.h"
|
2018-07-10 10:36:24 +02:00
|
|
|
#include "meta/common.h"
|
|
|
|
#include "meta/types.h"
|
|
|
|
#include "ui/theme-private.h"
|
|
|
|
#include "ui/ui.h"
|
2001-06-18 03:24:25 +00:00
|
|
|
|
|
|
|
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,
|
2001-09-11 03:54:54 +00:00
|
|
|
META_FRAME_CONTROL_UNMAXIMIZE,
|
2001-06-18 03:24:25 +00:00
|
|
|
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,
|
2001-10-14 04:11:42 +00:00
|
|
|
META_FRAME_CONTROL_RESIZE_E,
|
|
|
|
META_FRAME_CONTROL_CLIENT_AREA
|
2001-06-18 03:24:25 +00:00
|
|
|
} MetaFrameControl;
|
2001-06-12 04:38:24 +00:00
|
|
|
|
|
|
|
/* This is one widget that manages all the window frames
|
|
|
|
* as subwindows.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define META_TYPE_FRAMES (meta_frames_get_type ())
|
2009-08-04 09:17:20 +01:00
|
|
|
#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))
|
2001-06-12 04:38:24 +00:00
|
|
|
|
|
|
|
typedef struct _MetaFrames MetaFrames;
|
|
|
|
typedef struct _MetaFramesClass MetaFramesClass;
|
|
|
|
|
2001-06-21 03:40:14 +00:00
|
|
|
struct _MetaUIFrame
|
|
|
|
{
|
2014-12-31 22:04:11 -08:00
|
|
|
MetaFrames *frames;
|
2015-01-01 11:39:55 -08:00
|
|
|
MetaWindow *meta_window;
|
2001-06-21 03:40:14 +00:00
|
|
|
Window xwindow;
|
|
|
|
GdkWindow *window;
|
2014-09-24 00:07:21 +02:00
|
|
|
MetaStyleInfo *style_info;
|
2014-09-25 09:04:31 +02:00
|
|
|
MetaFrameLayout *cache_layout;
|
2014-09-27 08:10:59 +02:00
|
|
|
PangoLayout *text_layout;
|
2002-02-09 17:02:38 +00:00
|
|
|
int text_height;
|
|
|
|
char *title; /* NULL once we have a layout */
|
2014-05-31 02:22:21 +02:00
|
|
|
guint maybe_ignore_leave_notify : 1;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2002-02-15 02:32:48 +00:00
|
|
|
/* FIXME get rid of this, it can just be in the MetaFrames struct */
|
2002-02-12 05:01:22 +00:00
|
|
|
MetaFrameControl prelit_control;
|
2014-04-24 13:04:15 -04:00
|
|
|
MetaButtonState button_state;
|
|
|
|
int grab_button;
|
2020-01-15 10:40:54 +01:00
|
|
|
|
|
|
|
gboolean is_frozen;
|
2001-06-21 03:40:14 +00:00
|
|
|
};
|
|
|
|
|
2001-06-12 04:38:24 +00:00
|
|
|
struct _MetaFrames
|
|
|
|
{
|
|
|
|
GtkWindow parent_instance;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2019-10-14 11:32:54 +02:00
|
|
|
MetaX11Display *x11_display;
|
|
|
|
|
2002-02-09 17:02:38 +00:00
|
|
|
GHashTable *text_heights;
|
2001-06-15 04:33:21 +00:00
|
|
|
|
|
|
|
GHashTable *frames;
|
2001-08-19 01:19:54 +00:00
|
|
|
|
2014-09-24 00:07:21 +02:00
|
|
|
MetaStyleInfo *normal_style;
|
2011-03-18 13:56:30 +01:00
|
|
|
GHashTable *style_variants;
|
2014-04-24 13:04:15 -04:00
|
|
|
|
frames: Keep information about the ongoing grab operation, and retry if needed.
When a passive touch grab is rejected over the frame, management is punted to
the frame itself, and pointer events emulated, but the attempt to transfer the
grab from the GDK connection to the Clutter one fails with AlreadyGrabbed, and
will fail until the Clutter connection receives the XI_TouchEnd resulting from
XIRejectTouch, gotten after the XI_ButtonPress on the GDK connection.
In order to bypass this shortcoming, store the current grab operation on the
frame as long as the button is pressed, so it is retried once on the next
motion event happening during frame dragging, that will have a recent enough
timestamp to succeed. If no grabbing succeeded, the current grab operation
data will be reset on GDK_BUTTON_RELEASE.
2014-06-19 23:26:15 +02:00
|
|
|
MetaGrabOp current_grab_op;
|
|
|
|
MetaUIFrame *grab_frame;
|
|
|
|
guint grab_button;
|
|
|
|
gdouble grab_x;
|
|
|
|
gdouble grab_y;
|
2018-04-15 16:26:32 +02:00
|
|
|
|
|
|
|
ClutterEventSequence *grab_touch;
|
2001-06-12 04:38:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _MetaFramesClass
|
|
|
|
{
|
|
|
|
GtkWindowClass parent_class;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
GType meta_frames_get_type (void) G_GNUC_CONST;
|
|
|
|
|
2019-10-14 11:32:54 +02:00
|
|
|
MetaFrames * meta_frames_new (MetaX11Display *x11_display);
|
2001-06-12 04:38:24 +00:00
|
|
|
|
2014-12-31 21:55:36 -08:00
|
|
|
MetaUIFrame * meta_frames_manage_window (MetaFrames *frames,
|
2015-01-01 11:39:55 -08:00
|
|
|
MetaWindow *meta_window,
|
2014-12-31 21:55:36 -08:00
|
|
|
Window xwindow,
|
|
|
|
GdkWindow *window);
|
2014-12-31 22:09:23 -08:00
|
|
|
|
|
|
|
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);
|
|
|
|
|
2015-01-01 10:33:27 -08:00
|
|
|
cairo_region_t * meta_ui_frame_get_bounds (MetaUIFrame *frame);
|
2014-12-31 22:09:23 -08:00
|
|
|
|
2020-01-16 11:42:04 +01:00
|
|
|
void meta_ui_frame_get_mask (MetaUIFrame *frame,
|
|
|
|
cairo_rectangle_int_t *frame_rect,
|
|
|
|
cairo_t *cr);
|
2014-12-31 22:09:23 -08:00
|
|
|
|
|
|
|
void meta_ui_frame_move_resize (MetaUIFrame *frame,
|
|
|
|
int x, int y, int width, int height);
|
|
|
|
|
|
|
|
void meta_ui_frame_queue_draw (MetaUIFrame *frame);
|
2001-06-18 03:24:25 +00:00
|
|
|
|
2015-01-19 11:27:27 -08:00
|
|
|
gboolean meta_ui_frame_handle_event (MetaUIFrame *frame, const ClutterEvent *event);
|
|
|
|
|
2001-06-12 04:38:24 +00:00
|
|
|
#endif
|