~elementary-os/elementaryos/os-patch-mutter-bionic

« back to all changes in this revision

Viewing changes to src/ui/frames.h

  • Committer: RabbitBot
  • Date: 2018-04-11 14:49:36 UTC
  • Revision ID: rabbitbot@elementary.io-20180411144936-hgymqa9d8d1xfpbh
Initial import, version 3.28.0-2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
 
2
 
 
3
/* Metacity window frame manager widget */
 
4
 
 
5
/*
 
6
 * Copyright (C) 2001 Havoc Pennington
 
7
 *
 
8
 * This program is free software; you can redistribute it and/or
 
9
 * modify it under the terms of the GNU General Public License as
 
10
 * published by the Free Software Foundation; either version 2 of the
 
11
 * License, or (at your option) any later version.
 
12
 *
 
13
 * This program is distributed in the hope that it will be useful, but
 
14
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
16
 * General Public License for more details.
 
17
 *
 
18
 * You should have received a copy of the GNU General Public License
 
19
 * along with this program; if not, see <http://www.gnu.org/licenses/>.
 
20
 */
 
21
 
 
22
#ifndef META_FRAMES_H
 
23
#define META_FRAMES_H
 
24
 
 
25
#include <gtk/gtk.h>
 
26
#include <gdk/gdkx.h>
 
27
#include <meta/common.h>
 
28
#include <meta/types.h>
 
29
#include "theme-private.h"
 
30
#include "ui.h"
 
31
 
 
32
typedef enum
 
33
{
 
34
  META_FRAME_CONTROL_NONE,
 
35
  META_FRAME_CONTROL_TITLE,
 
36
  META_FRAME_CONTROL_DELETE,
 
37
  META_FRAME_CONTROL_MENU,
 
38
  META_FRAME_CONTROL_APPMENU,
 
39
  META_FRAME_CONTROL_MINIMIZE,
 
40
  META_FRAME_CONTROL_MAXIMIZE,
 
41
  META_FRAME_CONTROL_UNMAXIMIZE,
 
42
  META_FRAME_CONTROL_RESIZE_SE,
 
43
  META_FRAME_CONTROL_RESIZE_S,
 
44
  META_FRAME_CONTROL_RESIZE_SW,
 
45
  META_FRAME_CONTROL_RESIZE_N,
 
46
  META_FRAME_CONTROL_RESIZE_NE,
 
47
  META_FRAME_CONTROL_RESIZE_NW,
 
48
  META_FRAME_CONTROL_RESIZE_W,
 
49
  META_FRAME_CONTROL_RESIZE_E,
 
50
  META_FRAME_CONTROL_CLIENT_AREA
 
51
} MetaFrameControl;
 
52
 
 
53
/* This is one widget that manages all the window frames
 
54
 * as subwindows.
 
55
 */
 
56
 
 
57
#define META_TYPE_FRAMES            (meta_frames_get_type ())
 
58
#define META_FRAMES(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_FRAMES, MetaFrames))
 
59
#define META_FRAMES_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_FRAMES, MetaFramesClass))
 
60
#define META_IS_FRAMES(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_FRAMES))
 
61
#define META_IS_FRAMES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_FRAMES))
 
62
#define META_FRAMES_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_FRAMES, MetaFramesClass))
 
63
 
 
64
typedef struct _MetaFrames        MetaFrames;
 
65
typedef struct _MetaFramesClass   MetaFramesClass;
 
66
 
 
67
struct _MetaUIFrame
 
68
{
 
69
  MetaFrames *frames;
 
70
  MetaWindow *meta_window;
 
71
  Window xwindow;
 
72
  GdkWindow *window;
 
73
  MetaStyleInfo *style_info;
 
74
  MetaFrameLayout *cache_layout;
 
75
  PangoLayout *text_layout;
 
76
  int text_height;
 
77
  char *title; /* NULL once we have a layout */
 
78
  guint maybe_ignore_leave_notify : 1;
 
79
 
 
80
  /* FIXME get rid of this, it can just be in the MetaFrames struct */
 
81
  MetaFrameControl prelit_control;
 
82
  MetaButtonState button_state;
 
83
  int grab_button;
 
84
};
 
85
 
 
86
struct _MetaFrames
 
87
{
 
88
  GtkWindow parent_instance;
 
89
 
 
90
  GHashTable *text_heights;
 
91
 
 
92
  GHashTable *frames;
 
93
 
 
94
  MetaStyleInfo *normal_style;
 
95
  GHashTable *style_variants;
 
96
 
 
97
  MetaGrabOp current_grab_op;
 
98
  MetaUIFrame *grab_frame;
 
99
  guint grab_button;
 
100
  gdouble grab_x;
 
101
  gdouble grab_y;
 
102
};
 
103
 
 
104
struct _MetaFramesClass
 
105
{
 
106
  GtkWindowClass parent_class;
 
107
 
 
108
};
 
109
 
 
110
GType        meta_frames_get_type               (void) G_GNUC_CONST;
 
111
 
 
112
MetaFrames *meta_frames_new (void);
 
113
 
 
114
MetaUIFrame * meta_frames_manage_window (MetaFrames *frames,
 
115
                                         MetaWindow *meta_window,
 
116
                                         Window      xwindow,
 
117
                                         GdkWindow  *window);
 
118
 
 
119
void meta_ui_frame_unmanage (MetaUIFrame *frame);
 
120
 
 
121
void meta_ui_frame_set_title (MetaUIFrame *frame,
 
122
                              const char *title);
 
123
 
 
124
void meta_ui_frame_update_style (MetaUIFrame *frame);
 
125
 
 
126
void meta_ui_frame_get_borders (MetaUIFrame      *frame,
 
127
                                MetaFrameBorders *borders);
 
128
 
 
129
cairo_region_t * meta_ui_frame_get_bounds (MetaUIFrame *frame);
 
130
 
 
131
void meta_ui_frame_get_mask (MetaUIFrame *frame,
 
132
                             cairo_t     *cr);
 
133
 
 
134
void meta_ui_frame_move_resize (MetaUIFrame *frame,
 
135
                                int x, int y, int width, int height);
 
136
 
 
137
void meta_ui_frame_queue_draw (MetaUIFrame *frame);
 
138
 
 
139
gboolean meta_ui_frame_handle_event (MetaUIFrame *frame, const ClutterEvent *event);
 
140
 
 
141
#endif