Adapt to the new Mtk library

As we plan to slowly phase out Cairo where possible in libmutter
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3128

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2873>
This commit is contained in:
Bilal Elmoussaoui 2023-08-08 20:07:03 +02:00 committed by Marge Bot
parent 533f3fe69d
commit 80237b1082
19 changed files with 99 additions and 82 deletions

View File

@ -2,7 +2,7 @@
import Clutter from 'gi://Clutter'; import Clutter from 'gi://Clutter';
import GObject from 'gi://GObject'; import GObject from 'gi://GObject';
import Meta from 'gi://Meta'; import Mtk from 'gi://Mtk';
import St from 'gi://St'; import St from 'gi://St';
import * as Main from './main.js'; import * as Main from './main.js';
@ -25,7 +25,7 @@ export const EdgeDragAction = GObject.registerClass({
} }
_getMonitorRect(x, y) { _getMonitorRect(x, y) {
let rect = new Meta.Rectangle({x: x - 1, y: y - 1, width: 1, height: 1}); const rect = new Mtk.Rectangle({x: x - 1, y: y - 1, width: 1, height: 1});
let monitorIndex = global.display.get_monitor_index_for_rect(rect); let monitorIndex = global.display.get_monitor_index_for_rect(rect);
return global.display.get_monitor_geometry(monitorIndex); return global.display.get_monitor_geometry(monitorIndex);

View File

@ -5,6 +5,7 @@ import Gio from 'gi://Gio';
import GLib from 'gi://GLib'; import GLib from 'gi://GLib';
import GObject from 'gi://GObject'; import GObject from 'gi://GObject';
import Meta from 'gi://Meta'; import Meta from 'gi://Meta';
import Mtk from 'gi://Mtk';
import Shell from 'gi://Shell'; import Shell from 'gi://Shell';
import St from 'gi://St'; import St from 'gi://St';
import * as Signals from '../misc/signals.js'; import * as Signals from '../misc/signals.js';
@ -985,7 +986,7 @@ export const LayoutManager = GObject.registerClass({
findIndexForActor(actor) { findIndexForActor(actor) {
let [x, y] = actor.get_transformed_position(); let [x, y] = actor.get_transformed_position();
let [w, h] = actor.get_transformed_size(); let [w, h] = actor.get_transformed_size();
let rect = new Meta.Rectangle({x, y, width: w, height: h}); const rect = new Mtk.Rectangle({x, y, width: w, height: h});
return global.display.get_monitor_index_for_rect(rect); return global.display.get_monitor_index_for_rect(rect);
} }
@ -1049,7 +1050,7 @@ export const LayoutManager = GObject.registerClass({
h = Math.round(h); h = Math.round(h);
if (actorData.affectsInputRegion && wantsInputRegion && actorData.actor.get_paint_visibility()) if (actorData.affectsInputRegion && wantsInputRegion && actorData.actor.get_paint_visibility())
rects.push(new Meta.Rectangle({x, y, width: w, height: h})); rects.push(new Mtk.Rectangle({x, y, width: w, height: h}));
let monitor = null; let monitor = null;
if (actorData.affectsStruts) if (actorData.affectsStruts)
@ -1099,7 +1100,7 @@ export const LayoutManager = GObject.registerClass({
continue; continue;
} }
let strutRect = new Meta.Rectangle({x: x1, y: y1, width: x2 - x1, height: y2 - y1}); const strutRect = new Mtk.Rectangle({x: x1, y: y1, width: x2 - x1, height: y2 - y1});
let strut = new Meta.Strut({rect: strutRect, side}); let strut = new Meta.Strut({rect: strutRect, side});
struts.push(strut); struts.push(strut);
} }

View File

@ -7,6 +7,7 @@ import GObject from 'gi://GObject';
import GLib from 'gi://GLib'; import GLib from 'gi://GLib';
import Graphene from 'gi://Graphene'; import Graphene from 'gi://Graphene';
import Meta from 'gi://Meta'; import Meta from 'gi://Meta';
import Mtk from 'gi://Mtk';
import Shell from 'gi://Shell'; import Shell from 'gi://Shell';
import St from 'gi://St'; import St from 'gi://St';
@ -2655,7 +2656,7 @@ class SelectArea extends St.Widget {
} }
_getGeometry() { _getGeometry() {
return new Meta.Rectangle({ return new Mtk.Rectangle({
x: Math.min(this._startX, this._lastX), x: Math.min(this._startX, this._lastX),
y: Math.min(this._startY, this._lastY), y: Math.min(this._startY, this._lastY),
width: Math.abs(this._startX - this._lastX) + 1, width: Math.abs(this._startX - this._lastX) + 1,

View File

@ -3,7 +3,7 @@
import Clutter from 'gi://Clutter'; import Clutter from 'gi://Clutter';
import Gio from 'gi://Gio'; import Gio from 'gi://Gio';
import GObject from 'gi://GObject'; import GObject from 'gi://GObject';
import Meta from 'gi://Meta'; import Mtk from 'gi://Mtk';
import * as Main from './main.js'; import * as Main from './main.js';
import * as Params from '../misc/params.js'; import * as Params from '../misc/params.js';
@ -595,7 +595,7 @@ export const SwipeTracker = GObject.registerClass({
this._history.append(time, 0); this._history.append(time, 0);
let rect = new Meta.Rectangle({x, y, width: 1, height: 1}); const rect = new Mtk.Rectangle({x, y, width: 1, height: 1});
let monitor = global.display.get_monitor_index_for_rect(rect); let monitor = global.display.get_monitor_index_for_rect(rect);
this.emit('begin', monitor); this.emit('begin', monitor);

View File

@ -5,6 +5,7 @@ import Gio from 'gi://Gio';
import GLib from 'gi://GLib'; import GLib from 'gi://GLib';
import GObject from 'gi://GObject'; import GObject from 'gi://GObject';
import Meta from 'gi://Meta'; import Meta from 'gi://Meta';
import Mtk from 'gi://Mtk';
import Shell from 'gi://Shell'; import Shell from 'gi://Shell';
import St from 'gi://St'; import St from 'gi://St';
@ -417,7 +418,7 @@ class TilePreview extends St.Widget {
this._updateStyle(monitor); this._updateStyle(monitor);
if (!this._showing || changeMonitor) { if (!this._showing || changeMonitor) {
const monitorRect = new Meta.Rectangle({ const monitorRect = new Mtk.Rectangle({
x: monitor.x, x: monitor.x,
y: monitor.y, y: monitor.y,
width: monitor.width, width: monitor.width,

View File

@ -4,6 +4,7 @@ import Clutter from 'gi://Clutter';
import Gio from 'gi://Gio'; import Gio from 'gi://Gio';
import GObject from 'gi://GObject'; import GObject from 'gi://GObject';
import Meta from 'gi://Meta'; import Meta from 'gi://Meta';
import Mtk from 'gi://Mtk';
import Shell from 'gi://Shell'; import Shell from 'gi://Shell';
import St from 'gi://St'; import St from 'gi://St';
@ -1052,7 +1053,7 @@ class WorkspacesDisplay extends St.Widget {
_getMonitorIndexForEvent(event) { _getMonitorIndexForEvent(event) {
let [x, y] = event.get_coords(); let [x, y] = event.get_coords();
let rect = new Meta.Rectangle({x, y, width: 1, height: 1}); const rect = new Mtk.Rectangle({x, y, width: 1, height: 1});
return global.display.get_monitor_index_for_rect(rect); return global.display.get_monitor_index_for_rect(rect);
} }

View File

@ -15,6 +15,7 @@ mutter_api_version = '13'
clutter_pc = 'mutter-clutter-' + mutter_api_version clutter_pc = 'mutter-clutter-' + mutter_api_version
cogl_pc = 'mutter-cogl-' + mutter_api_version cogl_pc = 'mutter-cogl-' + mutter_api_version
cogl_pango_pc = 'mutter-cogl-pango-' + mutter_api_version cogl_pango_pc = 'mutter-cogl-pango-' + mutter_api_version
mtk_pc = 'mutter-mtk-' + mutter_api_version
libmutter_pc = 'libmutter-' + mutter_api_version libmutter_pc = 'libmutter-' + mutter_api_version
libmutter_test_pc = 'libmutter-test-' + mutter_api_version libmutter_test_pc = 'libmutter-test-' + mutter_api_version
@ -83,6 +84,7 @@ gjs_dep = dependency('gjs-1.0', version: gjs_req)
gtk_dep = dependency('gtk4', version: gtk_req) gtk_dep = dependency('gtk4', version: gtk_req)
libxml_dep = dependency('libxml-2.0') libxml_dep = dependency('libxml-2.0')
clutter_dep = dependency(clutter_pc, version: mutter_req) clutter_dep = dependency(clutter_pc, version: mutter_req)
mtk_dep = dependency(mtk_pc, version: mutter_req)
cogl_dep = dependency(cogl_pc, version: mutter_req) cogl_dep = dependency(cogl_pc, version: mutter_req)
cogl_pango_dep = dependency(cogl_pango_pc, version: mutter_req) cogl_pango_dep = dependency(cogl_pango_pc, version: mutter_req)
mutter_dep = dependency(libmutter_pc, version: mutter_req) mutter_dep = dependency(libmutter_pc, version: mutter_req)

View File

@ -42,6 +42,7 @@
#include <meta/meta-plugin.h> #include <meta/meta-plugin.h>
#include <meta/meta-x11-display.h> #include <meta/meta-x11-display.h>
#include <meta/util.h> #include <meta/util.h>
#include <mtk/mtk.h>
#include "shell-global-private.h" #include "shell-global-private.h"
#include "shell-perf-log.h" #include "shell-perf-log.h"
@ -165,8 +166,8 @@ static void
gnome_shell_plugin_size_change (MetaPlugin *plugin, gnome_shell_plugin_size_change (MetaPlugin *plugin,
MetaWindowActor *actor, MetaWindowActor *actor,
MetaSizeChange which_change, MetaSizeChange which_change,
MetaRectangle *old_frame_rect, MtkRectangle *old_frame_rect,
MetaRectangle *old_buffer_rect) MtkRectangle *old_buffer_rect)
{ {
_shell_wm_size_change (get_shell_wm (), actor, which_change, old_frame_rect, old_buffer_rect); _shell_wm_size_change (get_shell_wm (), actor, which_change, old_frame_rect, old_buffer_rect);
} }
@ -212,7 +213,7 @@ gnome_shell_plugin_kill_switch_workspace (MetaPlugin *plugin)
static void static void
gnome_shell_plugin_show_tile_preview (MetaPlugin *plugin, gnome_shell_plugin_show_tile_preview (MetaPlugin *plugin,
MetaWindow *window, MetaWindow *window,
MetaRectangle *tile_rect, MtkRectangle *tile_rect,
int tile_monitor) int tile_monitor)
{ {
_shell_wm_show_tile_preview (get_shell_wm (), window, tile_rect, tile_monitor); _shell_wm_show_tile_preview (get_shell_wm (), window, tile_rect, tile_monitor);
@ -238,7 +239,7 @@ static void
gnome_shell_plugin_show_window_menu_for_rect (MetaPlugin *plugin, gnome_shell_plugin_show_window_menu_for_rect (MetaPlugin *plugin,
MetaWindow *window, MetaWindow *window,
MetaWindowMenuType menu, MetaWindowMenuType menu,
MetaRectangle *rect) MtkRectangle *rect)
{ {
_shell_wm_show_window_menu_for_rect (get_shell_wm (), window, menu, rect); _shell_wm_show_window_menu_for_rect (get_shell_wm (), window, menu, rect);
} }

View File

@ -57,6 +57,7 @@ gnome_shell_deps = [
atk_bridge_dep, atk_bridge_dep,
gdk_pixbuf_dep, gdk_pixbuf_dep,
gjs_dep, gjs_dep,
mtk_dep,
clutter_dep, clutter_dep,
cogl_pango_dep, cogl_pango_dep,
startup_dep, startup_dep,
@ -83,7 +84,7 @@ libshell_menu_sources = [
libshell_menu = library('gnome-shell-menu', libshell_menu = library('gnome-shell-menu',
sources: libshell_menu_sources, sources: libshell_menu_sources,
dependencies: [gio_dep, clutter_dep], dependencies: [gio_dep, clutter_dep, mtk_dep],
include_directories: conf_inc, include_directories: conf_inc,
build_rpath: mutter_typelibdir, build_rpath: mutter_typelibdir,
install_rpath: mutter_typelibdir, install_rpath: mutter_typelibdir,
@ -271,7 +272,7 @@ executable('gnome-shell-perf-helper', 'shell-perf-helper.c', js_resources,
) )
executable('run-js-test', 'run-js-test.c', executable('run-js-test', 'run-js-test.c',
dependencies: [mutter_dep, gdk_pixbuf_dep, gio_dep, gi_dep, gjs_dep], dependencies: [mutter_dep, mtk_dep, gdk_pixbuf_dep, gio_dep, gi_dep, gjs_dep],
include_directories: [conf_inc], include_directories: [conf_inc],
link_with: libshell, link_with: libshell,
build_rpath: mutter_typelibdir, build_rpath: mutter_typelibdir,

View File

@ -18,6 +18,8 @@
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
*/ */
#include <mtk/mtk.h>
#include "shell-blur-effect.h" #include "shell-blur-effect.h"
#include "shell-enum-types.h" #include "shell-enum-types.h"
@ -342,7 +344,7 @@ update_actor_box (ShellBlurEffect *self,
if (stage_view) if (stage_view)
{ {
cairo_rectangle_int_t stage_view_layout; MtkRectangle stage_view_layout;
box_scale_factor = clutter_stage_view_get_scale (stage_view); box_scale_factor = clutter_stage_view_get_scale (stage_view);
clutter_stage_view_get_layout (stage_view, &stage_view_layout); clutter_stage_view_get_layout (stage_view, &stage_view_layout);

View File

@ -27,6 +27,7 @@
#include <meta/meta-settings.h> #include <meta/meta-settings.h>
#include <meta/meta-workspace-manager.h> #include <meta/meta-workspace-manager.h>
#include <meta/meta-x11-display.h> #include <meta/meta-x11-display.h>
#include <mtk/mtk.h>
#define GNOME_DESKTOP_USE_UNSTABLE_API #define GNOME_DESKTOP_USE_UNSTABLE_API
#include <libgnome-desktop/gnome-systemd.h> #include <libgnome-desktop/gnome-systemd.h>
@ -844,7 +845,7 @@ sync_input_region (ShellGlobal *global)
/** /**
* shell_global_set_stage_input_region: * shell_global_set_stage_input_region:
* @global: the #ShellGlobal * @global: the #ShellGlobal
* @rectangles: (element-type Meta.Rectangle): a list of #MetaRectangle * @rectangles: (element-type Mtk.Rectangle): a list of #MtkRectangle
* describing the input region. * describing the input region.
* *
* Sets the area of the stage that is responsive to mouse clicks when * Sets the area of the stage that is responsive to mouse clicks when
@ -854,7 +855,7 @@ void
shell_global_set_stage_input_region (ShellGlobal *global, shell_global_set_stage_input_region (ShellGlobal *global,
GSList *rectangles) GSList *rectangles)
{ {
MetaRectangle *rect; MtkRectangle *rect;
XRectangle *rects; XRectangle *rects;
int nrects, i; int nrects, i;
GSList *r; GSList *r;
@ -868,7 +869,7 @@ shell_global_set_stage_input_region (ShellGlobal *global,
rects = g_new (XRectangle, nrects); rects = g_new (XRectangle, nrects);
for (r = rectangles, i = 0; r; r = r->next, i++) for (r = rectangles, i = 0; r; r = r->next, i++)
{ {
rect = (MetaRectangle *)r->data; rect = (MtkRectangle *)r->data;
rects[i].x = rect->x; rects[i].x = rect->x;
rects[i].y = rect->y; rects[i].y = rect->y;
rects[i].width = rect->width; rects[i].width = rect->width;

View File

@ -54,7 +54,7 @@ struct _ShellScreenshotPrivate
GDateTime *datetime; GDateTime *datetime;
cairo_surface_t *image; cairo_surface_t *image;
cairo_rectangle_int_t screenshot_area; MtkRectangle screenshot_area;
gboolean include_frame; gboolean include_frame;
@ -77,7 +77,7 @@ shell_screenshot_class_init (ShellScreenshotClass *screenshot_class)
NULL, NULL, NULL, NULL, NULL, NULL,
G_TYPE_NONE, G_TYPE_NONE,
1, 1,
META_TYPE_RECTANGLE); MTK_TYPE_RECTANGLE);
} }
static void static void
@ -329,7 +329,7 @@ do_grab_screenshot (ShellScreenshot *screenshot,
{ {
ShellScreenshotPrivate *priv = screenshot->priv; ShellScreenshotPrivate *priv = screenshot->priv;
ClutterStage *stage = shell_global_get_stage (priv->global); ClutterStage *stage = shell_global_get_stage (priv->global);
cairo_rectangle_int_t screenshot_rect = { x, y, width, height }; MtkRectangle screenshot_rect = { x, y, width, height };
int image_width; int image_width;
int image_height; int image_height;
float scale; float scale;
@ -366,8 +366,8 @@ do_grab_screenshot (ShellScreenshot *screenshot,
} }
static void static void
draw_cursor_image (cairo_surface_t *surface, draw_cursor_image (cairo_surface_t *surface,
cairo_rectangle_int_t area) MtkRectangle area)
{ {
CoglTexture *texture; CoglTexture *texture;
int width, height; int width, height;
@ -420,7 +420,7 @@ draw_cursor_image (cairo_surface_t *surface,
{ {
int monitor; int monitor;
float monitor_scale; float monitor_scale;
MetaRectangle cursor_rect = { MtkRectangle cursor_rect = {
.x = x, .y = y, .width = width, .height = height .x = x, .y = y, .width = width, .height = height
}; };
@ -477,7 +477,7 @@ grab_screenshot_content (ShellScreenshot *screenshot,
ShellScreenshotPrivate *priv = screenshot->priv; ShellScreenshotPrivate *priv = screenshot->priv;
MetaDisplay *display; MetaDisplay *display;
int width, height; int width, height;
cairo_rectangle_int_t screenshot_rect; MtkRectangle screenshot_rect;
ClutterStage *stage; ClutterStage *stage;
int image_width; int image_width;
int image_height; int image_height;
@ -491,7 +491,7 @@ grab_screenshot_content (ShellScreenshot *screenshot,
display = shell_global_get_display (priv->global); display = shell_global_get_display (priv->global);
meta_display_get_size (display, &width, &height); meta_display_get_size (display, &width, &height);
screenshot_rect = (cairo_rectangle_int_t) { screenshot_rect = (MtkRectangle) {
.x = 0, .x = 0,
.y = 0, .y = 0,
.width = width, .width = width,
@ -571,7 +571,7 @@ grab_screenshot_content (ShellScreenshot *screenshot,
// MetaCursorRenderer. // MetaCursorRenderer.
if (view) if (view)
{ {
cairo_rectangle_int_t view_layout; MtkRectangle view_layout;
float view_scale; float view_scale;
clutter_stage_view_get_layout (view, &view_layout); clutter_stage_view_get_layout (view, &view_layout);
@ -604,7 +604,7 @@ grab_window_screenshot (ShellScreenshot *screenshot,
MetaWindow *window = meta_display_get_focus_window (display); MetaWindow *window = meta_display_get_focus_window (display);
ClutterActor *window_actor; ClutterActor *window_actor;
gfloat actor_x, actor_y; gfloat actor_x, actor_y;
MetaRectangle rect; MtkRectangle rect;
window_actor = CLUTTER_ACTOR (meta_window_get_compositor_private (window)); window_actor = CLUTTER_ACTOR (meta_window_get_compositor_private (window));
clutter_actor_get_position (window_actor, &actor_x, &actor_y); clutter_actor_get_position (window_actor, &actor_x, &actor_y);
@ -650,10 +650,10 @@ grab_window_screenshot (ShellScreenshot *screenshot,
} }
static gboolean static gboolean
finish_screenshot (ShellScreenshot *screenshot, finish_screenshot (ShellScreenshot *screenshot,
GAsyncResult *result, GAsyncResult *result,
cairo_rectangle_int_t **area, MtkRectangle **area,
GError **error) GError **error)
{ {
ShellScreenshotPrivate *priv = screenshot->priv; ShellScreenshotPrivate *priv = screenshot->priv;
@ -697,7 +697,7 @@ on_after_paint (ClutterStage *stage,
} }
g_signal_emit (screenshot, signals[SCREENSHOT_TAKEN], 0, g_signal_emit (screenshot, signals[SCREENSHOT_TAKEN], 0,
(cairo_rectangle_int_t *) &priv->screenshot_area); (MtkRectangle *) &priv->screenshot_area);
meta_enable_unredirect_for_display (display); meta_enable_unredirect_for_display (display);
} }
@ -759,7 +759,7 @@ shell_screenshot_screenshot (ShellScreenshot *screenshot,
grab_screenshot (screenshot, flags, result); grab_screenshot (screenshot, flags, result);
g_signal_emit (screenshot, signals[SCREENSHOT_TAKEN], 0, g_signal_emit (screenshot, signals[SCREENSHOT_TAKEN], 0,
(cairo_rectangle_int_t *) &priv->screenshot_area); (MtkRectangle *) &priv->screenshot_area);
} }
else else
{ {
@ -789,10 +789,10 @@ shell_screenshot_screenshot (ShellScreenshot *screenshot,
* *
*/ */
gboolean gboolean
shell_screenshot_screenshot_finish (ShellScreenshot *screenshot, shell_screenshot_screenshot_finish (ShellScreenshot *screenshot,
GAsyncResult *result, GAsyncResult *result,
cairo_rectangle_int_t **area, MtkRectangle **area,
GError **error) GError **error)
{ {
g_return_val_if_fail (SHELL_IS_SCREENSHOT (screenshot), FALSE); g_return_val_if_fail (SHELL_IS_SCREENSHOT (screenshot), FALSE);
g_return_val_if_fail (G_IS_TASK (result), FALSE); g_return_val_if_fail (G_IS_TASK (result), FALSE);
@ -989,7 +989,7 @@ shell_screenshot_screenshot_area (ShellScreenshot *screenshot,
SHELL_SCREENSHOT_FLAG_NONE); SHELL_SCREENSHOT_FLAG_NONE);
g_signal_emit (screenshot, signals[SCREENSHOT_TAKEN], 0, g_signal_emit (screenshot, signals[SCREENSHOT_TAKEN], 0,
(cairo_rectangle_int_t *) &priv->screenshot_area); (MtkRectangle *) &priv->screenshot_area);
task = g_task_new (screenshot, NULL, on_screenshot_written, result); task = g_task_new (screenshot, NULL, on_screenshot_written, result);
g_task_run_in_thread (task, write_screenshot_thread); g_task_run_in_thread (task, write_screenshot_thread);
@ -1022,10 +1022,10 @@ shell_screenshot_screenshot_area (ShellScreenshot *screenshot,
* *
*/ */
gboolean gboolean
shell_screenshot_screenshot_area_finish (ShellScreenshot *screenshot, shell_screenshot_screenshot_area_finish (ShellScreenshot *screenshot,
GAsyncResult *result, GAsyncResult *result,
cairo_rectangle_int_t **area, MtkRectangle **area,
GError **error) GError **error)
{ {
g_return_val_if_fail (SHELL_IS_SCREENSHOT (screenshot), FALSE); g_return_val_if_fail (SHELL_IS_SCREENSHOT (screenshot), FALSE);
g_return_val_if_fail (G_IS_TASK (result), FALSE); g_return_val_if_fail (G_IS_TASK (result), FALSE);
@ -1105,10 +1105,10 @@ shell_screenshot_screenshot_window (ShellScreenshot *screenshot,
* *
*/ */
gboolean gboolean
shell_screenshot_screenshot_window_finish (ShellScreenshot *screenshot, shell_screenshot_screenshot_window_finish (ShellScreenshot *screenshot,
GAsyncResult *result, GAsyncResult *result,
cairo_rectangle_int_t **area, MtkRectangle **area,
GError **error) GError **error)
{ {
g_return_val_if_fail (SHELL_IS_SCREENSHOT (screenshot), FALSE); g_return_val_if_fail (SHELL_IS_SCREENSHOT (screenshot), FALSE);
g_return_val_if_fail (G_IS_TASK (result), FALSE); g_return_val_if_fail (G_IS_TASK (result), FALSE);

View File

@ -2,6 +2,8 @@
#ifndef __SHELL_SCREENSHOT_H__ #ifndef __SHELL_SCREENSHOT_H__
#define __SHELL_SCREENSHOT_H__ #define __SHELL_SCREENSHOT_H__
#include <mtk/mtk.h>
/** /**
* SECTION:shell-screenshot * SECTION:shell-screenshot
* @short_description: Grabs screenshots of areas and/or windows * @short_description: Grabs screenshots of areas and/or windows
@ -24,10 +26,10 @@ void shell_screenshot_screenshot_area (ShellScreenshot *screenshot,
GOutputStream *stream, GOutputStream *stream,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data); gpointer user_data);
gboolean shell_screenshot_screenshot_area_finish (ShellScreenshot *screenshot, gboolean shell_screenshot_screenshot_area_finish (ShellScreenshot *screenshot,
GAsyncResult *result, GAsyncResult *result,
cairo_rectangle_int_t **area, MtkRectangle **area,
GError **error); GError **error);
void shell_screenshot_screenshot_window (ShellScreenshot *screenshot, void shell_screenshot_screenshot_window (ShellScreenshot *screenshot,
gboolean include_frame, gboolean include_frame,
@ -35,20 +37,20 @@ void shell_screenshot_screenshot_window (ShellScreenshot *screenshot,
GOutputStream *stream, GOutputStream *stream,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data); gpointer user_data);
gboolean shell_screenshot_screenshot_window_finish (ShellScreenshot *screenshot, gboolean shell_screenshot_screenshot_window_finish (ShellScreenshot *screenshot,
GAsyncResult *result, GAsyncResult *result,
cairo_rectangle_int_t **area, MtkRectangle **area,
GError **error); GError **error);
void shell_screenshot_screenshot (ShellScreenshot *screenshot, void shell_screenshot_screenshot (ShellScreenshot *screenshot,
gboolean include_cursor, gboolean include_cursor,
GOutputStream *stream, GOutputStream *stream,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data); gpointer user_data);
gboolean shell_screenshot_screenshot_finish (ShellScreenshot *screenshot, gboolean shell_screenshot_screenshot_finish (ShellScreenshot *screenshot,
GAsyncResult *result, GAsyncResult *result,
cairo_rectangle_int_t **area, MtkRectangle **area,
GError **error); GError **error);
void shell_screenshot_screenshot_stage_to_content (ShellScreenshot *screenshot, void shell_screenshot_screenshot_stage_to_content (ShellScreenshot *screenshot,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,

View File

@ -2,6 +2,8 @@
#include <clutter/clutter.h> #include <clutter/clutter.h>
#include <meta/window.h> #include <meta/window.h>
#include <mtk/mtk.h>
#include "shell-window-preview-layout.h" #include "shell-window-preview-layout.h"
typedef struct _ShellWindowPreviewLayoutPrivate ShellWindowPreviewLayoutPrivate; typedef struct _ShellWindowPreviewLayoutPrivate ShellWindowPreviewLayoutPrivate;
@ -155,7 +157,7 @@ shell_window_preview_layout_allocate (ClutterLayoutManager *layout,
if (window_info) if (window_info)
{ {
MetaRectangle buffer_rect; MtkRectangle buffer_rect;
float child_nat_width, child_nat_height; float child_nat_width, child_nat_height;
meta_window_get_buffer_rect (window_info->window, &buffer_rect); meta_window_get_buffer_rect (window_info->window, &buffer_rect);
@ -193,7 +195,7 @@ on_layout_changed (ShellWindowPreviewLayout *self)
GHashTableIter iter; GHashTableIter iter;
gpointer value; gpointer value;
gboolean first_rect = TRUE; gboolean first_rect = TRUE;
MetaRectangle bounding_rect = { 0, }; MtkRectangle bounding_rect = { 0, };
ClutterActorBox old_bounding_box; ClutterActorBox old_bounding_box;
priv = shell_window_preview_layout_get_instance_private (self); priv = shell_window_preview_layout_get_instance_private (self);
@ -208,7 +210,7 @@ on_layout_changed (ShellWindowPreviewLayout *self)
while (g_hash_table_iter_next (&iter, NULL, &value)) while (g_hash_table_iter_next (&iter, NULL, &value))
{ {
WindowInfo *window_info = value; WindowInfo *window_info = value;
MetaRectangle frame_rect; MtkRectangle frame_rect;
meta_window_get_frame_rect (window_info->window, &frame_rect); meta_window_get_frame_rect (window_info->window, &frame_rect);
@ -219,7 +221,7 @@ on_layout_changed (ShellWindowPreviewLayout *self)
continue; continue;
} }
meta_rectangle_union (&frame_rect, &bounding_rect, &bounding_rect); mtk_rectangle_union (&frame_rect, &bounding_rect, &bounding_rect);
} }
clutter_actor_box_set_origin (&priv->bounding_box, clutter_actor_box_set_origin (&priv->bounding_box,

View File

@ -3,6 +3,7 @@
#define __SHELL_WM_PRIVATE_H__ #define __SHELL_WM_PRIVATE_H__
#include "shell-wm.h" #include "shell-wm.h"
#include <mtk/mtk.h>
G_BEGIN_DECLS G_BEGIN_DECLS
@ -17,8 +18,8 @@ void _shell_wm_size_changed(ShellWM *wm,
void _shell_wm_size_change(ShellWM *wm, void _shell_wm_size_change(ShellWM *wm,
MetaWindowActor *actor, MetaWindowActor *actor,
MetaSizeChange which_change, MetaSizeChange which_change,
MetaRectangle *old_frame_rect, MtkRectangle *old_frame_rect,
MetaRectangle *old_buffer_rect); MtkRectangle *old_buffer_rect);
void _shell_wm_map (ShellWM *wm, void _shell_wm_map (ShellWM *wm,
MetaWindowActor *actor); MetaWindowActor *actor);
void _shell_wm_destroy (ShellWM *wm, void _shell_wm_destroy (ShellWM *wm,
@ -34,7 +35,7 @@ void _shell_wm_kill_switch_workspace (ShellWM *wm);
void _shell_wm_show_tile_preview (ShellWM *wm, void _shell_wm_show_tile_preview (ShellWM *wm,
MetaWindow *window, MetaWindow *window,
MetaRectangle *tile_rect, MtkRectangle *tile_rect,
int tile_monitor); int tile_monitor);
void _shell_wm_hide_tile_preview (ShellWM *wm); void _shell_wm_hide_tile_preview (ShellWM *wm);
void _shell_wm_show_window_menu (ShellWM *wm, void _shell_wm_show_window_menu (ShellWM *wm,
@ -45,7 +46,7 @@ void _shell_wm_show_window_menu (ShellWM *wm,
void _shell_wm_show_window_menu_for_rect (ShellWM *wm, void _shell_wm_show_window_menu_for_rect (ShellWM *wm,
MetaWindow *window, MetaWindow *window,
MetaWindowMenuType menu, MetaWindowMenuType menu,
MetaRectangle *rect); MtkRectangle *rect);
gboolean _shell_wm_filter_keybinding (ShellWM *wm, gboolean _shell_wm_filter_keybinding (ShellWM *wm,
MetaKeyBinding *binding); MetaKeyBinding *binding);

View File

@ -92,7 +92,7 @@ shell_wm_class_init (ShellWMClass *klass)
0, 0,
NULL, NULL, NULL, NULL, NULL, NULL,
G_TYPE_NONE, 4, G_TYPE_NONE, 4,
META_TYPE_WINDOW_ACTOR, META_TYPE_SIZE_CHANGE, META_TYPE_RECTANGLE, META_TYPE_RECTANGLE); META_TYPE_WINDOW_ACTOR, META_TYPE_SIZE_CHANGE, MTK_TYPE_RECTANGLE, MTK_TYPE_RECTANGLE);
shell_wm_signals[MAP] = shell_wm_signals[MAP] =
g_signal_new ("map", g_signal_new ("map",
G_TYPE_FROM_CLASS (klass), G_TYPE_FROM_CLASS (klass),
@ -139,7 +139,7 @@ shell_wm_class_init (ShellWMClass *klass)
0, NULL, NULL, NULL, 0, NULL, NULL, NULL,
G_TYPE_NONE, 3, G_TYPE_NONE, 3,
META_TYPE_WINDOW, META_TYPE_WINDOW,
META_TYPE_RECTANGLE, MTK_TYPE_RECTANGLE,
G_TYPE_INT); G_TYPE_INT);
shell_wm_signals[HIDE_TILE_PREVIEW] = shell_wm_signals[HIDE_TILE_PREVIEW] =
g_signal_new ("hide-tile-preview", g_signal_new ("hide-tile-preview",
@ -154,7 +154,7 @@ shell_wm_class_init (ShellWMClass *klass)
G_SIGNAL_RUN_LAST, G_SIGNAL_RUN_LAST,
0, NULL, NULL, NULL, 0, NULL, NULL, NULL,
G_TYPE_NONE, 3, G_TYPE_NONE, 3,
META_TYPE_WINDOW, G_TYPE_INT, META_TYPE_RECTANGLE); META_TYPE_WINDOW, G_TYPE_INT, MTK_TYPE_RECTANGLE);
shell_wm_signals[FILTER_KEYBINDING] = shell_wm_signals[FILTER_KEYBINDING] =
g_signal_new ("filter-keybinding", g_signal_new ("filter-keybinding",
G_TYPE_FROM_CLASS (klass), G_TYPE_FROM_CLASS (klass),
@ -320,7 +320,7 @@ _shell_wm_kill_window_effects (ShellWM *wm,
void void
_shell_wm_show_tile_preview (ShellWM *wm, _shell_wm_show_tile_preview (ShellWM *wm,
MetaWindow *window, MetaWindow *window,
MetaRectangle *tile_rect, MtkRectangle *tile_rect,
int tile_monitor) int tile_monitor)
{ {
g_signal_emit (wm, shell_wm_signals[SHOW_TILE_PREVIEW], 0, g_signal_emit (wm, shell_wm_signals[SHOW_TILE_PREVIEW], 0,
@ -340,7 +340,7 @@ _shell_wm_show_window_menu (ShellWM *wm,
int x, int x,
int y) int y)
{ {
MetaRectangle rect; MtkRectangle rect;
rect.x = x; rect.x = x;
rect.y = y; rect.y = y;
@ -353,7 +353,7 @@ void
_shell_wm_show_window_menu_for_rect (ShellWM *wm, _shell_wm_show_window_menu_for_rect (ShellWM *wm,
MetaWindow *window, MetaWindow *window,
MetaWindowMenuType menu, MetaWindowMenuType menu,
MetaRectangle *rect) MtkRectangle *rect)
{ {
g_signal_emit (wm, shell_wm_signals[SHOW_WINDOW_MENU], 0, window, menu, rect); g_signal_emit (wm, shell_wm_signals[SHOW_WINDOW_MENU], 0, window, menu, rect);
} }
@ -383,8 +383,8 @@ void
_shell_wm_size_change (ShellWM *wm, _shell_wm_size_change (ShellWM *wm,
MetaWindowActor *actor, MetaWindowActor *actor,
MetaSizeChange which_change, MetaSizeChange which_change,
MetaRectangle *old_frame_rect, MtkRectangle *old_frame_rect,
MetaRectangle *old_buffer_rect) MtkRectangle *old_buffer_rect)
{ {
g_signal_emit (wm, shell_wm_signals[SIZE_CHANGE], 0, actor, which_change, old_frame_rect, old_buffer_rect); g_signal_emit (wm, shell_wm_signals[SIZE_CHANGE], 0, actor, which_change, old_frame_rect, old_buffer_rect);
} }

View File

@ -4,6 +4,7 @@
#include "shell-global.h" #include "shell-global.h"
#include <meta/meta-workspace-manager.h> #include <meta/meta-workspace-manager.h>
#include <mtk/mtk.h>
#define BACKGROUND_MARGIN 12 #define BACKGROUND_MARGIN 12
@ -27,8 +28,8 @@ struct _ShellWorkspaceBackground
int monitor_index; int monitor_index;
double state_adjustment_value; double state_adjustment_value;
MetaRectangle work_area; MtkRectangle work_area;
MetaRectangle monitor_geometry; MtkRectangle monitor_geometry;
}; };
G_DEFINE_TYPE (ShellWorkspaceBackground, shell_workspace_background, ST_TYPE_WIDGET); G_DEFINE_TYPE (ShellWorkspaceBackground, shell_workspace_background, ST_TYPE_WIDGET);

View File

@ -183,7 +183,7 @@ st_cflags = [
libst = shared_library('st-' + mutter_api_version, libst = shared_library('st-' + mutter_api_version,
sources: st_gir_sources + st_nogir_sources + croco_sources, sources: st_gir_sources + st_nogir_sources + croco_sources,
c_args: st_cflags, c_args: st_cflags,
dependencies: [clutter_dep, mutter_dep, libxml_dep, gdk_pixbuf_dep, m_dep, schemas_dep], dependencies: [mtk_dep, clutter_dep, mutter_dep, libxml_dep, gdk_pixbuf_dep, m_dep, schemas_dep],
build_rpath: mutter_typelibdir, build_rpath: mutter_typelibdir,
install_rpath: mutter_typelibdir, install_rpath: mutter_typelibdir,
install_dir: pkglibdir, install_dir: pkglibdir,
@ -199,7 +199,7 @@ if get_option('tests')
test_theme = executable('test-theme', test_theme = executable('test-theme',
sources: 'test-theme.c', sources: 'test-theme.c',
c_args: st_cflags, c_args: st_cflags,
dependencies: [mutter_test_dep, libxml_dep], dependencies: [mutter_test_dep, mtk_dep, libxml_dep],
build_rpath: mutter_typelibdir, build_rpath: mutter_typelibdir,
link_with: libst link_with: libst
) )

View File

@ -9,6 +9,6 @@ tray_sources = [
libtray = static_library('tray', tray_sources, libtray = static_library('tray', tray_sources,
c_args: ['-DG_LOG_DOMAIN="notification_area"'], c_args: ['-DG_LOG_DOMAIN="notification_area"'],
dependencies: [mutter_dep], dependencies: [mutter_dep, mtk_dep],
include_directories: conf_inc include_directories: conf_inc
) )