Compare commits

..

11 Commits

Author SHA1 Message Date
Carlos Garnacho
8d75ea69e3 wayland: Use weak ref to keep track of buffers
Instead of using a one-shot signal meant to happen then the buffer
is being destroyed.

https://bugzilla.gnome.org/show_bug.cgi?id=782344
2017-05-22 17:43:10 +02:00
Carlos Garnacho
a7ee7559e4 compositor: Use redraw clip region to cull out children
This will avoid repainting too much of the background if the
bounding box turned out to be too large.

https://bugzilla.gnome.org/show_bug.cgi?id=782344
2017-05-22 17:43:10 +02:00
Carlos Garnacho
af3475f65f ClutterStage: Store clip area as a region
This will allow drawing optimizations as a region is more concrete
than the bounding rectangle.

https://bugzilla.gnome.org/show_bug.cgi?id=782344
2017-05-22 17:43:10 +02:00
Carlos Garnacho
77fd682c8b ClutterActor: Preserve valid paint volumes till the next relayout/repaint
Cuts down approximately 55% of paint volumes calculation when there's
windows that redraw frequently, but don't move.

https://bugzilla.gnome.org/show_bug.cgi?id=782344
2017-05-22 17:43:10 +02:00
Carlos Garnacho
fa8e4f60f6 compositor: Ensure to clip partial shadow redraws
Otherwise we end up drawing too far outside the clip area, which
brings in artifacts now that we have tighter regions instead of
an overlapping rect.

https://bugzilla.gnome.org/show_bug.cgi?id=782344
2017-05-22 17:43:10 +02:00
Carlos Garnacho
b98a8d9932 clutter: Avoid rounding compensation when invalidating 2D actors
This allows the redraw clip to be more constrained, so MetaCullable doesn't
end up rendering portions of window shadows, frame and background when a
window invalidates (part of) its contents.

https://bugzilla.gnome.org/show_bug.cgi?id=782344
2017-05-22 17:43:10 +02:00
Carlos Garnacho
864bc793aa cogl: Ensure to only clear the depth buffer if depth testing is enabled
The depth buffer is marked as invalid when 1) the framebuffer is just created,
and 2) whenever GL_DEPTH_TEST is enabled on it. This will ensure the
framebuffers attached depth buffer (if any) is properly cleared before it's
actually used, while saving needless clears while depth testing is disabled
(the default).

https://bugzilla.gnome.org/show_bug.cgi?id=782344
2017-05-22 17:43:10 +02:00
Carlos Garnacho
e5b06754e0 compositor: Remove MetaSurfaceActor::repaint-scheduled signal
It's unused now.

https://bugzilla.gnome.org/show_bug.cgi?id=782344
2017-05-22 17:43:09 +02:00
Carlos Garnacho
3402c50625 compositor: Use queue_redraw vmethod over repaint-scheduled signal
https://bugzilla.gnome.org/show_bug.cgi?id=782344
2017-05-22 17:43:09 +02:00
Carlos Garnacho
060543466c compositor: Avoid changing pipeline/source if shadow is not being painted
Avoids some context invalidations in cogl.

https://bugzilla.gnome.org/show_bug.cgi?id=782344
2017-05-22 17:43:09 +02:00
Carlos Garnacho
65e816908a clutter: Add ClutterPaintVolume argument to ClutterActor::queue_redraw
This is an ABI break, hopefully an unimportant one since this signal/vmethod
is barely overridden.

The signal has been added an extra ClutterPaintVolume argument, and has been
given a boolean return value. The recursion to the parents has been taken
out of the default implementation and into the caller, using the returned
boolean parameter to control further propagation.

Passing the ClutterPaintVolume is easier on performance, as we don't need
setting this pointer as gobject data just to retrieve/unset it further
in propagation.

https://bugzilla.gnome.org/show_bug.cgi?id=782344
2017-05-22 17:43:09 +02:00
119 changed files with 2064 additions and 7275 deletions

69
NEWS
View File

@@ -1,72 +1,3 @@
3.25.4
======
* Do not throttle motion events on tablet tools [Carlos; #783535]
* Handle left-handed mode on pen/eraser devices [Carlos; #782027]
* Add wl_surface.damage_buffer() support [Jonas; #784080]
* Fix crash when moving across on-adjacent monitors [Jonas; #783630]
* Fix window moving/resizing via tablet tools [Jason; #777333]
* Support fractional monitor scaling [Jonas, Marco; #765011]
* Keep override-redirect windows stacked on top [Rui; #780485]
* Implement tablet rings/strips configuration [Carlos; #782033]
* Support tablet wheel events on wayland [Jason; #783716]
* Move g-s-d xrandr functionality into mutter [Rui; #781906]
* Misc. bug fixes [Florian, Jason, Miguel, Carlos, Jonas; #783502, #784009,
#784223, #784272, #784402, #784881, #762083, #784867, #781723]
Contributors:
Jonas Ådahl, Miguel A. Vico, Emmanuele Bassi, Carlos Garnacho, Jason Gerecke,
Rui Matos, Florian Müllner, Marco Trevisan (Treviño)
3.25.3
======
* Ignore hotplug-mode-update value on startup [Marco; #783073]
* Implement configurable monitor scales on X11 [Jonas; #777732]
* Fix handling of tiled monitors [Jonas; #781723]
* Handle multiple keycodes for keysym [Christian; #781223]
* Consider subsurfaces when grabbing [mindtree; #781811]
* Fix logic for HiPDPI scaling of TV outputs [Christian; #777347]
* Fix handling of left-handed mode on pen/eraser devices [Carlos; #782027]
* Fix output cycling in non-display-attached tablets [Carlos; #782032]
* Fix wacom cursor offset on wayland [Jason; #784009]
* Handle EXIF orientation of backgrounds [Silvère; #783125]
* Misc. bug fixes [Piotr, Tim, Bastien, Jonas, Florian, Benoit, Carlos; #772218,
#783161, #780407, #783113, #783293, #783505, #781703]
Contributors:
mitchmindtree, Jonas Ådahl, Ikey Doherty, Piotr Drąg, Carlos Garnacho,
Jason Gerecke, Benoit Gschwind, Christian Kellner, Silvère Latchurié,
Tim Lunn, Florian Müllner, Bastien Nocera, Marco Trevisan (Treviño)
Translations:
Fabio Tomat [fur], Kukuh Syafaat [id], Khaled Hosny [ar],
Daniel Mustieles [es]
3.25.2
======
* Fix frame updates on hide-titlebar-when-maximized changes [Florian; #781862]
* Fix accessible screen coordinates on X11 [Florian; #781902]
* Use less CPU when rendering fast-updating windows [Carlos, Emmanuele; #782344]
* Compute geometry of clients that don't set one explicitly [Olivier; #782213]
* Fix copy+paste of UTF8 strings between X11 and wayland [Carlos; #782472]
* Fix non-wayland builds [Chris; #780533]
* Add plugin vfunc to implement a custom force-quit dialog [Carlos; #711619]
* Fix swapped red and blue channels in CoglTexture data [Carlos; #779234
* Fix build where libtool's link_all_deplibs defaults to 'no' [Marco; #782821]
* Fix glitches when opening a window maximized [Olivier; #781353, #782183]
* Fix wrong cursor after window underneath the pointer changed [Carlos; #755164]
* Implement support for disable-while-typing option [Evan; #764852]
* Emit size-change signal when tiling [Alessandro; #782968]
* Misc. bug fixes [Nigel, Matthias, Jonas; #759085, #780215, #782156, #782152]
Contributors:
Jonas Ådahl, Emmanuele Bassi, Alessandro Bono, Olivier Fourdan,
Carlos Garnacho, Matthias Liertzer, Florian Müllner, Nigel Taylor,
Marco Trevisan (Treviño), Chris Vine, Evan Welsh
Translations:
Fabio Tomat [fur], Jordi Mas [ca], Mario Blättermann [de],
Emin Tufan Çetin [tr], Balázs Úr [hu]
3.25.1
======
* Always sync window geometry on state changes [Jonas; #780292]

View File

@@ -34,7 +34,6 @@ stamp-marshal: $(marshal_list)
$(AM_V_GEN)$(GLIB_GENMARSHAL) \
--prefix=$(glib_marshal_prefix) \
--header \
--valist-marshallers \
$(marshal_list) > xgen-mh \
&& (cmp -s xgen-mh $(marshal_h) || cp -f xgen-mh $(marshal_h)) \
&& rm -f xgen-mh \
@@ -47,8 +46,6 @@ $(marshal_c): $(marshal_h)
$(AM_V_GEN)$(GLIB_GENMARSHAL) \
--prefix=$(glib_marshal_prefix) \
--body \
--valist-marshallers \
--prototypes \
$(marshal_list) > xgen-mc \
&& (cmp -s xgen-mc $(marshal_c) || cp -f xgen-mc $(marshal_c)) \
&& rm -f xgen-mc

View File

@@ -283,9 +283,6 @@ void _clutter_actor_queue_redraw_full
ClutterPaintVolume *volume,
ClutterEffect *effect);
ClutterPaintVolume * _clutter_actor_get_queue_redraw_clip (ClutterActor *self);
void _clutter_actor_set_queue_redraw_clip (ClutterActor *self,
ClutterPaintVolume *clip_volume);
void _clutter_actor_finish_queue_redraw (ClutterActor *self,
ClutterPaintVolume *clip);

View File

@@ -840,6 +840,7 @@ struct _ClutterActorPrivate
guint needs_compute_expand : 1;
guint needs_x_expand : 1;
guint needs_y_expand : 1;
guint needs_paint_volume_update : 1;
};
enum
@@ -2619,6 +2620,7 @@ clutter_actor_real_allocate (ClutterActor *self,
g_object_freeze_notify (G_OBJECT (self));
changed = clutter_actor_set_allocation_internal (self, box, flags);
priv->needs_paint_volume_update = changed;
/* we allocate our children before we notify changes in our geometry,
* so that people connecting to properties will be able to get valid
@@ -2641,9 +2643,12 @@ clutter_actor_real_allocate (ClutterActor *self,
}
static void
_clutter_actor_signal_queue_redraw (ClutterActor *self,
ClutterActor *origin)
_clutter_actor_propagate_queue_redraw (ClutterActor *self,
ClutterActor *origin,
ClutterPaintVolume *pv)
{
gboolean stop = FALSE;
/* no point in queuing a redraw on a destroyed actor */
if (CLUTTER_ACTOR_IN_DESTRUCTION (self))
return;
@@ -2652,27 +2657,33 @@ _clutter_actor_signal_queue_redraw (ClutterActor *self,
* the actor bas been cloned. In this case the clone will need to
* receive the signal so it can queue its own redraw.
*/
while (self)
{
_clutter_actor_queue_redraw_on_clones (self);
_clutter_actor_queue_redraw_on_clones (self);
/* calls klass->queue_redraw in default handler */
if (g_signal_has_handler_pending (self, actor_signals[QUEUE_REDRAW],
/* calls klass->queue_redraw in default handler */
if (g_signal_has_handler_pending (self, actor_signals[QUEUE_REDRAW],
0, TRUE))
{
g_signal_emit (self, actor_signals[QUEUE_REDRAW], 0, origin);
}
else
{
CLUTTER_ACTOR_GET_CLASS (self)->queue_redraw (self, origin);
{
g_signal_emit (self, actor_signals[QUEUE_REDRAW], 0, origin, pv, &stop);
}
else
{
stop = CLUTTER_ACTOR_GET_CLASS (self)->queue_redraw (self, origin, pv);
}
if (stop)
break;
self = clutter_actor_get_parent (self);
}
}
static void
clutter_actor_real_queue_redraw (ClutterActor *self,
ClutterActor *origin)
static gboolean
clutter_actor_real_queue_redraw (ClutterActor *self,
ClutterActor *origin,
ClutterPaintVolume *paint_volume)
{
ClutterActor *parent;
CLUTTER_NOTE (PAINT, "Redraw queued on '%s' (from: '%s')",
_clutter_actor_get_debug_name (self),
origin != NULL ? _clutter_actor_get_debug_name (origin)
@@ -2680,13 +2691,14 @@ clutter_actor_real_queue_redraw (ClutterActor *self,
/* no point in queuing a redraw on a destroyed actor */
if (CLUTTER_ACTOR_IN_DESTRUCTION (self))
return;
return TRUE;
/* If the queue redraw is coming from a child then the actor has
become dirty and any queued effect is no longer valid */
if (self != origin)
{
self->priv->is_dirty = TRUE;
self->priv->needs_paint_volume_update = TRUE;
self->priv->effect_to_redraw = NULL;
}
@@ -2695,7 +2707,7 @@ clutter_actor_real_queue_redraw (ClutterActor *self,
* won't change so we don't have to propagate up the hierarchy.
*/
if (!CLUTTER_ACTOR_IS_VISIBLE (self))
return;
return TRUE;
/* Although we could determine here that a full stage redraw
* has already been queued and immediately bail out, we actually
@@ -2709,7 +2721,7 @@ clutter_actor_real_queue_redraw (ClutterActor *self,
ClutterActor *stage = _clutter_actor_get_stage_internal (self);
if (stage != NULL &&
_clutter_stage_has_full_redraw_queued (CLUTTER_STAGE (stage)))
return;
return TRUE;
}
self->priv->propagated_one_redraw = TRUE;
@@ -2717,12 +2729,7 @@ clutter_actor_real_queue_redraw (ClutterActor *self,
/* notify parents, if they are all visible eventually we'll
* queue redraw on the stage, which queues the redraw idle.
*/
parent = clutter_actor_get_parent (self);
if (parent != NULL)
{
/* this will go up recursively */
_clutter_actor_signal_queue_redraw (parent, origin);
}
return FALSE;
}
static void
@@ -8011,10 +8018,12 @@ clutter_actor_class_init (ClutterActorClass *klass)
G_SIGNAL_RUN_LAST |
G_SIGNAL_NO_HOOKS,
G_STRUCT_OFFSET (ClutterActorClass, queue_redraw),
NULL, NULL,
_clutter_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
CLUTTER_TYPE_ACTOR);
g_signal_accumulator_true_handled,
NULL,
_clutter_marshal_BOOLEAN__OBJECT_BOXED,
G_TYPE_BOOLEAN, 2,
CLUTTER_TYPE_ACTOR,
CLUTTER_TYPE_PAINT_VOLUME);
/**
* ClutterActor::queue-relayout:
@@ -8519,6 +8528,7 @@ clutter_actor_init (ClutterActor *self)
priv->needs_width_request = TRUE;
priv->needs_height_request = TRUE;
priv->needs_allocation = TRUE;
priv->needs_paint_volume_update = TRUE;
priv->cached_width_age = 1;
priv->cached_height_age = 1;
@@ -8612,8 +8622,7 @@ _clutter_actor_finish_queue_redraw (ClutterActor *self,
ClutterPaintVolume *clip)
{
ClutterActorPrivate *priv = self->priv;
ClutterPaintVolume *pv;
gboolean clipped;
ClutterPaintVolume *pv = NULL;
/* Remove queue entry early in the process, otherwise a new
queue_redraw() during signal handling could put back this
@@ -8640,8 +8649,7 @@ _clutter_actor_finish_queue_redraw (ClutterActor *self,
*/
if (clip)
{
_clutter_actor_set_queue_redraw_clip (self, clip);
clipped = TRUE;
pv = clip;
}
else if (G_LIKELY (priv->last_paint_volume_valid))
{
@@ -8651,36 +8659,12 @@ _clutter_actor_finish_queue_redraw (ClutterActor *self,
ClutterActor *stage = _clutter_actor_get_stage_internal (self);
/* make sure we redraw the actors old position... */
_clutter_actor_set_queue_redraw_clip (stage,
&priv->last_paint_volume);
_clutter_actor_signal_queue_redraw (stage, stage);
_clutter_actor_set_queue_redraw_clip (stage, NULL);
/* XXX: Ideally the redraw signal would take a clip volume
* argument, but that would be an ABI break. Until we can
* break the ABI we pass the argument out-of-band
*/
/* setup the clip for the actors new position... */
_clutter_actor_set_queue_redraw_clip (self, pv);
clipped = TRUE;
_clutter_actor_propagate_queue_redraw (stage, stage,
&priv->last_paint_volume);
}
else
clipped = FALSE;
}
else
clipped = FALSE;
_clutter_actor_signal_queue_redraw (self, self);
/* Just in case anyone is manually firing redraw signals without
* using the public queue_redraw() API we are careful to ensure that
* our out-of-band clip member is cleared before returning...
*
* Note: A NULL clip denotes a full-stage, un-clipped redraw
*/
if (G_LIKELY (clipped))
_clutter_actor_set_queue_redraw_clip (self, NULL);
_clutter_actor_propagate_queue_redraw (self, self, pv);
}
static void
@@ -8841,8 +8825,7 @@ _clutter_actor_queue_redraw_full (ClutterActor *self,
{
/* NB: NULL denotes an undefined clip which will result in a
* full redraw... */
_clutter_actor_set_queue_redraw_clip (self, NULL);
_clutter_actor_signal_queue_redraw (self, self);
_clutter_actor_propagate_queue_redraw (self, self, NULL);
return;
}
@@ -8916,6 +8899,7 @@ _clutter_actor_queue_redraw_full (ClutterActor *self,
}
priv->is_dirty = TRUE;
priv->needs_paint_volume_update = TRUE;
}
/**
@@ -12973,6 +12957,7 @@ clutter_actor_add_child_internal (ClutterActor *self,
child->priv->needs_width_request = TRUE;
child->priv->needs_height_request = TRUE;
child->priv->needs_allocation = TRUE;
child->priv->needs_paint_volume_update = TRUE;
/* we only queue a relayout here, because any possible
* redraw has already been queued either by show() or
@@ -16650,26 +16635,6 @@ clutter_actor_has_pointer (ClutterActor *self)
return self->priv->has_pointer;
}
/* XXX: This is a workaround for not being able to break the ABI of
* the QUEUE_REDRAW signal. It is an out-of-band argument. See
* clutter_actor_queue_clipped_redraw() for details.
*/
ClutterPaintVolume *
_clutter_actor_get_queue_redraw_clip (ClutterActor *self)
{
return g_object_get_data (G_OBJECT (self),
"-clutter-actor-queue-redraw-clip");
}
void
_clutter_actor_set_queue_redraw_clip (ClutterActor *self,
ClutterPaintVolume *clip)
{
g_object_set_data (G_OBJECT (self),
"-clutter-actor-queue-redraw-clip",
clip);
}
/**
* clutter_actor_has_allocation:
* @self: a #ClutterActor
@@ -17516,16 +17481,22 @@ _clutter_actor_get_paint_volume_mutable (ClutterActor *self)
priv = self->priv;
if (priv->paint_volume_valid)
clutter_paint_volume_free (&priv->paint_volume);
{
if (!priv->needs_paint_volume_update)
return &priv->paint_volume;
clutter_paint_volume_free (&priv->paint_volume);
}
if (_clutter_actor_get_paint_volume_real (self, &priv->paint_volume))
{
priv->paint_volume_valid = TRUE;
priv->needs_paint_volume_update = FALSE;
return &priv->paint_volume;
}
else
{
priv->paint_volume_valid = FALSE;
priv->needs_paint_volume_update = FALSE;
return NULL;
}
}

View File

@@ -236,8 +236,9 @@ struct _ClutterActorClass
void (* pick) (ClutterActor *actor,
const ClutterColor *color);
void (* queue_redraw) (ClutterActor *actor,
ClutterActor *leaf_that_queued);
gboolean (* queue_redraw) (ClutterActor *actor,
ClutterActor *leaf_that_queued,
ClutterPaintVolume *paint_volume);
/* size negotiation */
void (* get_preferred_width) (ClutterActor *self,

View File

@@ -2179,61 +2179,3 @@ clutter_event_get_mode_group (const ClutterEvent *event)
return 0;
}
}
/**
* clutter_event_get_pad_event_details:
* @event: a pad event
* @number: (out) (optional): ring/strip/button number
* @mode: (out) (optional): pad mode as per the event
* @value: (out) (optional): event axis value
*
* Returns the details of a pad event.
*
* Returns: #TRUE if event details could be obtained
**/
gboolean
clutter_event_get_pad_event_details (const ClutterEvent *event,
guint *number,
guint *mode,
gdouble *value)
{
guint n, m;
gdouble v;
g_return_val_if_fail (event != NULL, FALSE);
g_return_val_if_fail (event->type == CLUTTER_PAD_BUTTON_PRESS ||
event->type == CLUTTER_PAD_BUTTON_RELEASE ||
event->type == CLUTTER_PAD_RING ||
event->type == CLUTTER_PAD_STRIP, FALSE);
switch (event->type)
{
case CLUTTER_PAD_BUTTON_PRESS:
case CLUTTER_PAD_BUTTON_RELEASE:
n = event->pad_button.button;
m = event->pad_button.mode;
v = 0.0;
break;
case CLUTTER_PAD_RING:
n = event->pad_ring.ring_number;
m = event->pad_ring.mode;
v = event->pad_ring.angle;
break;
case CLUTTER_PAD_STRIP:
n = event->pad_strip.strip_number;
m = event->pad_strip.mode;
v = event->pad_strip.value;
break;
default:
return FALSE;
}
if (number)
*number = n;
if (mode)
*mode = m;
if (value)
*value = v;
return TRUE;
}

View File

@@ -778,12 +778,6 @@ ClutterScrollFinishFlags clutter_event_get_scroll_finish_flags (const Clut
CLUTTER_AVAILABLE_IN_ALL
guint clutter_event_get_mode_group (const ClutterEvent *event);
CLUTTER_AVAILABLE_IN_MUTTER
gboolean clutter_event_get_pad_event_details (const ClutterEvent *event,
guint *number,
guint *mode,
gdouble *value);
G_END_DECLS

View File

@@ -2243,15 +2243,10 @@ clutter_input_device_get_device_node (ClutterInputDevice *device)
ClutterInputDeviceMapping
clutter_input_device_get_mapping_mode (ClutterInputDevice *device)
{
ClutterInputDeviceType device_type;
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device),
CLUTTER_INPUT_DEVICE_MAPPING_ABSOLUTE);
device_type = clutter_input_device_get_device_type (device);
g_return_val_if_fail (device_type == CLUTTER_TABLET_DEVICE ||
device_type == CLUTTER_PEN_DEVICE ||
device_type == CLUTTER_ERASER_DEVICE,
g_return_val_if_fail (clutter_input_device_get_device_type (device) ==
CLUTTER_TABLET_DEVICE,
CLUTTER_INPUT_DEVICE_MAPPING_ABSOLUTE);
return device->mapping_mode;
@@ -2261,14 +2256,9 @@ void
clutter_input_device_set_mapping_mode (ClutterInputDevice *device,
ClutterInputDeviceMapping mapping)
{
ClutterInputDeviceType device_type;
g_return_if_fail (CLUTTER_IS_INPUT_DEVICE (device));
device_type = clutter_input_device_get_device_type (device);
g_return_if_fail (device_type == CLUTTER_TABLET_DEVICE ||
device_type == CLUTTER_PEN_DEVICE ||
device_type == CLUTTER_ERASER_DEVICE);
g_return_if_fail (clutter_input_device_get_device_type (device) ==
CLUTTER_TABLET_DEVICE);
if (device->mapping_mode == mapping)
return;

View File

@@ -1,6 +1,7 @@
BOOLEAN:BOXED
BOOLEAN:BOXED,INT,INT
BOOLEAN:OBJECT,BOOLEAN
BOOLEAN:OBJECT,BOXED
BOOLEAN:OBJECT,BOXED,DOUBLE
BOOLEAN:OBJECT,DOUBLE
BOOLEAN:OBJECT,ENUM

View File

@@ -1166,6 +1166,21 @@ _clutter_paint_volume_get_stage_paint_box (ClutterPaintVolume *pv,
_clutter_paint_volume_get_bounding_box (&projected_pv, box);
if (pv->is_2d && pv->actor &&
clutter_actor_get_z_position (pv->actor) == 0)
{
/* If the volume/actor are perfectly 2D, take the bounding box as
* good. We won't need to add any extra room for sub-pixel positioning
* in this case.
*/
clutter_paint_volume_free (&projected_pv);
box->x1 = CLUTTER_NEARBYINT (box->x1);
box->y1 = CLUTTER_NEARBYINT (box->y1);
box->x2 = CLUTTER_NEARBYINT (box->x2);
box->y2 = CLUTTER_NEARBYINT (box->y2);
return;
}
/* The aim here is that for a given rectangle defined with floating point
* coordinates we want to determine a stable quantized size in pixels
* that doesn't vary due to the original box's sub-pixel position.

View File

@@ -20,7 +20,6 @@
#include "clutter/clutter-stage-view.h"
#include <cairo-gobject.h>
#include <math.h>
enum
{
@@ -39,7 +38,7 @@ static GParamSpec *obj_props[PROP_LAST];
typedef struct _ClutterStageViewPrivate
{
cairo_rectangle_int_t layout;
float scale;
int scale;
CoglFramebuffer *framebuffer;
CoglOffscreen *offscreen;
@@ -144,7 +143,7 @@ clutter_stage_view_blit_offscreen (ClutterStageView *view,
cogl_framebuffer_pop_matrix (priv->framebuffer);
}
float
int
clutter_stage_view_get_scale (ClutterStageView *view)
{
ClutterStageViewPrivate *priv =
@@ -242,7 +241,7 @@ clutter_stage_view_get_property (GObject *object,
g_value_set_boxed (value, priv->offscreen);
break;
case PROP_SCALE:
g_value_set_float (value, priv->scale);
g_value_set_int (value, priv->scale);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -268,26 +267,12 @@ clutter_stage_view_set_property (GObject *object,
break;
case PROP_FRAMEBUFFER:
priv->framebuffer = g_value_dup_boxed (value);
#ifndef G_DISABLE_CHECKS
if (priv->framebuffer)
{
int fb_width, fb_height;
fb_width = cogl_framebuffer_get_width (priv->framebuffer);
fb_height = cogl_framebuffer_get_height (priv->framebuffer);
g_warn_if_fail (fabsf (roundf (fb_width / priv->scale) -
fb_width / priv->scale) < FLT_EPSILON);
g_warn_if_fail (fabsf (roundf (fb_height / priv->scale) -
fb_height / priv->scale) < FLT_EPSILON);
}
#endif
break;
case PROP_OFFSCREEN:
priv->offscreen = g_value_dup_boxed (value);
break;
case PROP_SCALE:
priv->scale = g_value_get_float (value);
priv->scale = g_value_get_int (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -316,7 +301,7 @@ clutter_stage_view_init (ClutterStageView *view)
priv->dirty_viewport = TRUE;
priv->dirty_projection = TRUE;
priv->scale = 1.0;
priv->scale = 1;
}
static void
@@ -337,7 +322,6 @@ clutter_stage_view_class_init (ClutterStageViewClass *klass)
"The view layout on the screen",
CAIRO_GOBJECT_TYPE_RECTANGLE_INT,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT |
G_PARAM_STATIC_STRINGS);
obj_props[PROP_FRAMEBUFFER] =
@@ -346,7 +330,6 @@ clutter_stage_view_class_init (ClutterStageViewClass *klass)
"The front buffer of the view",
COGL_TYPE_HANDLE,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT |
G_PARAM_STATIC_STRINGS);
obj_props[PROP_OFFSCREEN] =
@@ -359,13 +342,12 @@ clutter_stage_view_class_init (ClutterStageViewClass *klass)
G_PARAM_STATIC_STRINGS);
obj_props[PROP_SCALE] =
g_param_spec_float ("scale",
"View scale",
"The view scale",
0.5, G_MAXFLOAT, 1.0,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT |
G_PARAM_STATIC_STRINGS);
g_param_spec_int ("scale",
"View scale",
"The view scale",
1, G_MAXINT, 1,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, PROP_LAST, obj_props);
}

View File

@@ -61,7 +61,7 @@ void clutter_stage_view_blit_offscreen (ClutterStageView *view,
const cairo_rectangle_int_t *clip);
CLUTTER_AVAILABLE_IN_MUTTER
float clutter_stage_view_get_scale (ClutterStageView *view);
int clutter_stage_view_get_scale (ClutterStageView *view);
gboolean clutter_stage_view_is_dirty_viewport (ClutterStageView *view);

View File

@@ -231,19 +231,35 @@ _clutter_stage_window_ignoring_redraw_clips (ClutterStageWindow *window)
return TRUE;
}
gboolean
_clutter_stage_window_get_redraw_clip_bounds (ClutterStageWindow *window,
cairo_rectangle_int_t *stage_clip)
cairo_region_t *
_clutter_stage_window_get_redraw_clip (ClutterStageWindow *window)
{
ClutterStageWindowIface *iface;
g_return_val_if_fail (CLUTTER_IS_STAGE_WINDOW (window), FALSE);
iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
if (iface->get_redraw_clip_bounds != NULL)
return iface->get_redraw_clip_bounds (window, stage_clip);
if (iface->get_redraw_clip != NULL)
return iface->get_redraw_clip (window);
return FALSE;
return NULL;
}
gboolean
_clutter_stage_window_get_redraw_clip_bounds (ClutterStageWindow *window,
cairo_rectangle_int_t *stage_clip)
{
cairo_region_t *redraw_clip;
g_return_val_if_fail (CLUTTER_IS_STAGE_WINDOW (window), FALSE);
redraw_clip = _clutter_stage_window_get_redraw_clip (window);
if (!redraw_clip)
return FALSE;
cairo_region_get_extents (redraw_clip, stage_clip);
cairo_region_destroy (redraw_clip);
return TRUE;
}
void

View File

@@ -68,9 +68,7 @@ struct _ClutterStageWindowIface
cairo_rectangle_int_t *stage_rectangle);
gboolean (* has_redraw_clips) (ClutterStageWindow *stage_window);
gboolean (* ignoring_redraw_clips) (ClutterStageWindow *stage_window);
gboolean (* get_redraw_clip_bounds) (ClutterStageWindow *stage_window,
cairo_rectangle_int_t *clip);
cairo_region_t * (* get_redraw_clip) (ClutterStageWindow *stage_window);
void (* set_accept_focus) (ClutterStageWindow *stage_window,
gboolean accept_focus);
@@ -125,6 +123,7 @@ gboolean _clutter_stage_window_has_redraw_clips (ClutterStageWin
gboolean _clutter_stage_window_ignoring_redraw_clips (ClutterStageWindow *window);
gboolean _clutter_stage_window_get_redraw_clip_bounds (ClutterStageWindow *window,
cairo_rectangle_int_t *clip);
cairo_region_t * _clutter_stage_window_get_redraw_clip (ClutterStageWindow *window);
void _clutter_stage_window_set_accept_focus (ClutterStageWindow *window,
gboolean accept_focus);

View File

@@ -161,7 +161,6 @@ struct _ClutterStagePrivate
guint accept_focus : 1;
guint motion_events_enabled : 1;
guint has_custom_perspective : 1;
guint stage_was_relayout : 1;
};
enum
@@ -962,7 +961,6 @@ _clutter_stage_process_queued_events (ClutterStage *stage)
ClutterEvent *next_event;
ClutterInputDevice *device;
ClutterInputDevice *next_device;
ClutterInputDeviceType device_type;
gboolean check_device = FALSE;
event = l->data;
@@ -978,16 +976,8 @@ _clutter_stage_process_queued_events (ClutterStage *stage)
if (device != NULL && next_device != NULL)
check_device = TRUE;
device_type = clutter_input_device_get_device_type (device);
/* Skip consecutive motion events coming from the same device,
* except those of tablet tools, since users of these events
* want no precision loss.
*/
if (priv->throttle_motion_events && next_event != NULL &&
device_type != CLUTTER_TABLET_DEVICE &&
device_type != CLUTTER_PEN_DEVICE &&
device_type != CLUTTER_ERASER_DEVICE)
/* Skip consecutive motion events coming from the same device */
if (priv->throttle_motion_events && next_event != NULL)
{
if (event->type == CLUTTER_MOTION &&
(next_event->type == CLUTTER_MOTION ||
@@ -1069,7 +1059,6 @@ _clutter_stage_maybe_relayout (ClutterActor *actor)
if (!CLUTTER_ACTOR_IN_RELAYOUT (stage))
{
priv->relayout_pending = FALSE;
priv->stage_was_relayout = TRUE;
CLUTTER_NOTE (ACTOR, "Recomputing layout");
@@ -1140,58 +1129,6 @@ clutter_stage_do_redraw (ClutterStage *stage)
stage);
}
static GSList *
_clutter_stage_check_updated_pointers (ClutterStage *stage)
{
ClutterStagePrivate *priv = stage->priv;
ClutterDeviceManager *device_manager;
GSList *updating = NULL;
const GSList *devices;
cairo_rectangle_int_t clip;
ClutterPoint point;
gboolean has_clip;
has_clip = _clutter_stage_window_get_redraw_clip_bounds (priv->impl, &clip);
device_manager = clutter_device_manager_get_default ();
devices = clutter_device_manager_peek_devices (device_manager);
for (; devices != NULL; devices = devices->next)
{
ClutterInputDevice *dev = devices->data;
if (clutter_input_device_get_device_mode (dev) !=
CLUTTER_INPUT_MODE_MASTER)
continue;
switch (clutter_input_device_get_device_type (dev))
{
case CLUTTER_POINTER_DEVICE:
case CLUTTER_TABLET_DEVICE:
case CLUTTER_PEN_DEVICE:
case CLUTTER_ERASER_DEVICE:
case CLUTTER_CURSOR_DEVICE:
if (!clutter_input_device_get_coords (dev, NULL, &point))
continue;
if (!has_clip ||
(point.x >= clip.x && point.x < clip.x + clip.width &&
point.y >= clip.y && point.y < clip.y + clip.height))
updating = g_slist_prepend (updating, dev);
break;
default:
/* Any other devices don't need checking, either because they
* don't have x/y coordinates, or because they're implicitly
* grabbed on an actor by default as it's the case of
* touch(screens).
*/
break;
}
}
return updating;
}
/**
* _clutter_stage_do_update:
* @stage: A #ClutterStage
@@ -1204,10 +1141,6 @@ gboolean
_clutter_stage_do_update (ClutterStage *stage)
{
ClutterStagePrivate *priv = stage->priv;
gboolean stage_was_relayout = priv->stage_was_relayout;
GSList *pointers = NULL;
priv->stage_was_relayout = FALSE;
/* if the stage is being destroyed, or if the destruction already
* happened and we don't have an StageWindow any more, then we
@@ -1228,9 +1161,6 @@ _clutter_stage_do_update (ClutterStage *stage)
if (!priv->redraw_pending)
return FALSE;
if (stage_was_relayout)
pointers = _clutter_stage_check_updated_pointers (stage);
clutter_stage_maybe_finish_queue_redraws (stage);
clutter_stage_do_redraw (stage);
@@ -1248,12 +1178,6 @@ _clutter_stage_do_update (ClutterStage *stage)
}
#endif /* CLUTTER_ENABLE_DEBUG */
while (pointers)
{
_clutter_input_device_update (pointers->data, NULL, TRUE);
pointers = g_slist_delete_link (pointers, pointers);
}
return TRUE;
}
@@ -1275,45 +1199,44 @@ clutter_stage_real_queue_relayout (ClutterActor *self)
parent_class->queue_relayout (self);
}
static void
clutter_stage_real_queue_redraw (ClutterActor *actor,
ClutterActor *leaf)
static gboolean
clutter_stage_real_queue_redraw (ClutterActor *actor,
ClutterActor *leaf,
ClutterPaintVolume *redraw_clip)
{
ClutterStage *stage = CLUTTER_STAGE (actor);
ClutterStageWindow *stage_window;
ClutterPaintVolume *redraw_clip;
ClutterActorBox bounding_box;
ClutterActorBox intersection_box;
cairo_rectangle_int_t geom, stage_clip;
if (CLUTTER_ACTOR_IN_DESTRUCTION (actor))
return;
return TRUE;
/* If the backend can't do anything with redraw clips (e.g. it already knows
* it needs to redraw everything anyway) then don't spend time transforming
* any clip volume into stage coordinates... */
stage_window = _clutter_stage_get_window (stage);
if (stage_window == NULL)
return;
return TRUE;
if (_clutter_stage_window_ignoring_redraw_clips (stage_window))
{
_clutter_stage_window_add_redraw_clip (stage_window, NULL);
return;
return FALSE;
}
/* Convert the clip volume into stage coordinates and then into an
* axis aligned stage coordinates bounding box...
*/
redraw_clip = _clutter_actor_get_queue_redraw_clip (leaf);
if (redraw_clip == NULL)
{
_clutter_stage_window_add_redraw_clip (stage_window, NULL);
return;
return FALSE;
}
if (redraw_clip->is_empty)
return;
return TRUE;
_clutter_paint_volume_get_stage_paint_box (redraw_clip,
stage,
@@ -1329,7 +1252,7 @@ clutter_stage_real_queue_redraw (ClutterActor *actor,
/* There is no need to track degenerate/empty redraw clips */
if (intersection_box.x2 <= intersection_box.x1 ||
intersection_box.y2 <= intersection_box.y1)
return;
return TRUE;
/* when converting to integer coordinates make sure we round the edges of the
* clip rectangle outwards... */
@@ -1339,6 +1262,7 @@ clutter_stage_real_queue_redraw (ClutterActor *actor,
stage_clip.height = intersection_box.y2 - stage_clip.y;
_clutter_stage_window_add_redraw_clip (stage_window, &stage_clip);
return FALSE;
}
gboolean
@@ -1391,6 +1315,31 @@ clutter_stage_get_redraw_clip_bounds (ClutterStage *stage,
}
}
cairo_region_t *
clutter_stage_get_redraw_clip (ClutterStage *stage)
{
ClutterStagePrivate *priv;
cairo_rectangle_int_t clip;
cairo_region_t *region;
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), NULL);
priv = stage->priv;
region = _clutter_stage_window_get_redraw_clip (priv->impl);
if (region)
return region;
if (!region)
{
/* Set clip to the full extents of the stage */
_clutter_stage_window_get_geometry (priv->impl, &clip);
region = cairo_region_create_rectangle (&clip);
}
return region;
}
static void
read_pixels_to_file (char *filename_stem,
int x,
@@ -1445,9 +1394,9 @@ _clutter_stage_do_pick_on_view (ClutterStage *stage,
gint read_x;
gint read_y;
float fb_width, fb_height;
float fb_scale;
float viewport_offset_x;
float viewport_offset_y;
int fb_scale;
int viewport_offset_x;
int viewport_offset_y;
priv = stage->priv;
@@ -1474,8 +1423,8 @@ _clutter_stage_do_pick_on_view (ClutterStage *stage,
if (G_LIKELY (!(clutter_pick_debug_flags & CLUTTER_DEBUG_DUMP_PICK_BUFFERS)))
{
CLUTTER_NOTE (PICK, "Pushing pick scissor clip x: %d, y: %d, 1x1",
(int) dirty_x * fb_scale,
(int) dirty_y * fb_scale);
dirty_x * fb_scale,
dirty_y * fb_scale);
cogl_framebuffer_push_scissor_clip (fb, dirty_x * fb_scale, dirty_y * fb_scale, 1, 1);
}
@@ -3622,9 +3571,9 @@ _clutter_stage_maybe_setup_viewport (ClutterStage *stage,
{
cairo_rectangle_int_t view_layout;
ClutterPerspective perspective;
float fb_scale;
float viewport_offset_x;
float viewport_offset_y;
int fb_scale;
int viewport_offset_x;
int viewport_offset_y;
float z_2d;
CLUTTER_NOTE (PAINT,
@@ -4720,7 +4669,6 @@ capture_view (ClutterStage *stage,
int stride;
CoglBitmap *bitmap;
cairo_rectangle_int_t view_layout;
float view_scale;
framebuffer = clutter_stage_view_get_framebuffer (view);
@@ -4731,11 +4679,8 @@ capture_view (ClutterStage *stage,
clutter_stage_do_paint_view (stage, view, rect);
}
view_scale = clutter_stage_view_get_scale (view);
image = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
rect->width * view_scale,
rect->height * view_scale);
cairo_surface_set_device_scale (image, view_scale, view_scale);
rect->width, rect->height);
data = cairo_image_surface_get_data (image);
stride = cairo_image_surface_get_stride (image);
@@ -4743,8 +4688,7 @@ capture_view (ClutterStage *stage,
backend = clutter_get_default_backend ();
context = clutter_backend_get_cogl_context (backend);
bitmap = cogl_bitmap_new_for_data (context,
rect->width * view_scale,
rect->height * view_scale,
rect->width, rect->height,
CLUTTER_CAIRO_FORMAT_ARGB32,
stride,
data);
@@ -4752,8 +4696,8 @@ capture_view (ClutterStage *stage,
clutter_stage_view_get_layout (view, &view_layout);
cogl_framebuffer_read_pixels_into_bitmap (framebuffer,
(rect->x - view_layout.x) * view_scale,
(rect->y - view_layout.y) * view_scale,
rect->x - view_layout.x,
rect->y - view_layout.y,
COGL_READ_PIXELS_COLOR_BUFFER,
bitmap);

View File

@@ -245,6 +245,9 @@ guchar * clutter_stage_read_pixels (ClutterStage
CLUTTER_AVAILABLE_IN_ALL
void clutter_stage_get_redraw_clip_bounds (ClutterStage *stage,
cairo_rectangle_int_t *clip);
CLUTTER_AVAILABLE_IN_MUTTER
cairo_region_t * clutter_stage_get_redraw_clip (ClutterStage *stage);
CLUTTER_AVAILABLE_IN_ALL
void clutter_stage_ensure_viewport (ClutterStage *stage);
CLUTTER_AVAILABLE_IN_ALL

View File

@@ -51,12 +51,10 @@
typedef struct _ClutterStageViewCoglPrivate
{
/*
* List of previous damaged areas in stage view framebuffer coordinate space.
*/
/* Stores a list of previous damaged areas in the stage coordinate space */
#define DAMAGE_HISTORY_MAX 16
#define DAMAGE_HISTORY(x) ((x) & (DAMAGE_HISTORY_MAX - 1))
cairo_rectangle_int_t damage_history[DAMAGE_HISTORY_MAX];
cairo_region_t * damage_history[DAMAGE_HISTORY_MAX];
unsigned int damage_index;
} ClutterStageViewCoglPrivate;
@@ -248,13 +246,10 @@ clutter_stage_cogl_has_redraw_clips (ClutterStageWindow *stage_window)
/* NB: at the start of each new frame there is an implied clip that
* clips everything (i.e. nothing would be drawn) so we need to make
* sure we return True in the un-initialized case here.
*
* NB: a clip width of 0 means a full stage redraw has been queued
* so we effectively don't have any redraw clips in that case.
*/
if (!stage_cogl->initialized_redraw_clip ||
(stage_cogl->initialized_redraw_clip &&
stage_cogl->bounding_redraw_clip.width != 0))
stage_cogl->redraw_clip))
return TRUE;
else
return FALSE;
@@ -265,9 +260,9 @@ clutter_stage_cogl_ignoring_redraw_clips (ClutterStageWindow *stage_window)
{
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
/* NB: a clip width of 0 means a full stage redraw is required */
/* NB: a NULL clip means a full stage redraw is required */
if (stage_cogl->initialized_redraw_clip &&
stage_cogl->bounding_redraw_clip.width == 0)
!stage_cogl->redraw_clip)
return TRUE;
else
return FALSE;
@@ -298,11 +293,11 @@ clutter_stage_cogl_add_redraw_clip (ClutterStageWindow *stage_window,
return;
/* A NULL stage clip means a full stage redraw has been queued and
* we keep track of this by setting a zero width
* stage_cogl->bounding_redraw_clip */
* we keep track of this by setting a NULL redraw_clip.
*/
if (stage_clip == NULL)
{
stage_cogl->bounding_redraw_clip.width = 0;
g_clear_pointer (&stage_cogl->redraw_clip, cairo_region_destroy);
stage_cogl->initialized_redraw_clip = TRUE;
return;
}
@@ -311,34 +306,27 @@ clutter_stage_cogl_add_redraw_clip (ClutterStageWindow *stage_window,
if (stage_clip->width == 0 || stage_clip->height == 0)
return;
if (!stage_cogl->initialized_redraw_clip)
if (!stage_cogl->redraw_clip)
{
stage_cogl->bounding_redraw_clip = *stage_clip;
stage_cogl->redraw_clip = cairo_region_create_rectangle (stage_clip);
}
else if (stage_cogl->bounding_redraw_clip.width > 0)
else
{
_clutter_util_rectangle_union (&stage_cogl->bounding_redraw_clip,
stage_clip,
&stage_cogl->bounding_redraw_clip);
cairo_region_union_rectangle (stage_cogl->redraw_clip, stage_clip);
}
stage_cogl->initialized_redraw_clip = TRUE;
}
static gboolean
clutter_stage_cogl_get_redraw_clip_bounds (ClutterStageWindow *stage_window,
cairo_rectangle_int_t *stage_clip)
static cairo_region_t *
clutter_stage_cogl_get_redraw_clip (ClutterStageWindow *stage_window)
{
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
if (stage_cogl->using_clipped_redraw)
{
*stage_clip = stage_cogl->bounding_redraw_clip;
if (stage_cogl->using_clipped_redraw && stage_cogl->redraw_clip)
return cairo_region_copy (stage_cogl->redraw_clip);
return TRUE;
}
return FALSE;
return NULL;
}
static inline gboolean
@@ -416,44 +404,51 @@ swap_framebuffer (ClutterStageWindow *stage_window,
static void
paint_stage (ClutterStageCogl *stage_cogl,
ClutterStageView *view,
const cairo_rectangle_int_t *clip)
cairo_region_t *clip)
{
ClutterStage *stage = stage_cogl->wrapper;
cairo_rectangle_int_t clip_rect;
cairo_region_get_extents (clip, &clip_rect);
_clutter_stage_maybe_setup_viewport (stage, view);
_clutter_stage_paint_view (stage, view, clip);
_clutter_stage_paint_view (stage, view, &clip_rect);
if (clutter_stage_view_get_onscreen (view) !=
clutter_stage_view_get_framebuffer (view))
{
clutter_stage_view_blit_offscreen (view, clip);
clutter_stage_view_blit_offscreen (view, &clip_rect);
}
}
static void
fill_current_damage_history_and_step (ClutterStageView *view)
fill_current_damage_history (ClutterStageView *view,
cairo_region_t *damage)
{
ClutterStageViewCogl *view_cogl = CLUTTER_STAGE_VIEW_COGL (view);
ClutterStageViewCoglPrivate *view_priv =
clutter_stage_view_cogl_get_instance_private (view_cogl);
cairo_rectangle_int_t view_rect;
float fb_scale;
cairo_rectangle_int_t *current_fb_damage;
cairo_region_t **current_damage;
current_fb_damage =
current_damage =
&view_priv->damage_history[DAMAGE_HISTORY (view_priv->damage_index)];
clutter_stage_view_get_layout (view, &view_rect);
fb_scale = clutter_stage_view_get_scale (view);
*current_fb_damage = (cairo_rectangle_int_t) {
.x = 0,
.y = 0,
.width = view_rect.width * fb_scale,
.height = view_rect.height * fb_scale
};
g_clear_pointer (current_damage, cairo_region_destroy);
*current_damage = cairo_region_copy (damage);
view_priv->damage_index++;
}
static void
fill_current_damage_history_rectangle (ClutterStageView *view,
const cairo_rectangle_int_t *rect)
{
cairo_region_t *damage;
damage = cairo_region_create_rectangle (rect);
fill_current_damage_history (view, damage);
cairo_region_destroy (damage);
}
static void
transform_swap_region_to_onscreen (ClutterStageView *view,
cairo_rectangle_int_t *swap_region)
@@ -490,40 +485,6 @@ transform_swap_region_to_onscreen (ClutterStageView *view,
};
}
static void
calculate_scissor_region (cairo_rectangle_int_t *fb_clip_region,
int subpixel_compensation,
int fb_width,
int fb_height,
cairo_rectangle_int_t *out_scissor_rect)
{
int scissor_x;
int scissor_y;
int scissor_width;
int scissor_height;
scissor_x = fb_clip_region->x;
scissor_y = fb_clip_region->y;
scissor_width = fb_clip_region->width;
scissor_height = fb_clip_region->height;
if (fb_clip_region->x > 0)
scissor_x += subpixel_compensation;
if (fb_clip_region->y > 0)
scissor_y += subpixel_compensation;
if (fb_clip_region->x + fb_clip_region->width < fb_width)
scissor_width -= 2 * subpixel_compensation;
if (fb_clip_region->y + fb_clip_region->height < fb_height)
scissor_height -= 2 * subpixel_compensation;
*out_scissor_rect = (cairo_rectangle_int_t) {
.x = scissor_x,
.y = scissor_y,
.width = scissor_width,
.height = scissor_height
};
}
static gboolean
clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
ClutterStageView *view)
@@ -542,20 +503,17 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
gboolean do_swap_buffer;
gboolean swap_with_damage;
ClutterActor *wrapper;
cairo_rectangle_int_t redraw_clip;
cairo_region_t *redraw_clip;
cairo_region_t *clip_region;
cairo_rectangle_int_t swap_region;
cairo_rectangle_int_t fb_clip_region;
cairo_rectangle_int_t clip_rect;
cairo_rectangle_int_t redraw_rect;
gboolean clip_region_empty;
float fb_scale;
int subpixel_compensation = 0;
int fb_width, fb_height;
int fb_scale;
wrapper = CLUTTER_ACTOR (stage_cogl->wrapper);
clutter_stage_view_get_layout (view, &view_rect);
fb_scale = clutter_stage_view_get_scale (view);
fb_width = cogl_framebuffer_get_width (fb);
fb_height = cogl_framebuffer_get_height (fb);
can_blit_sub_buffer =
cogl_is_onscreen (fb) &&
@@ -565,20 +523,19 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
cogl_is_onscreen (fb) &&
cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_BUFFER_AGE);
/* NB: a zero width redraw clip == full stage redraw */
if (stage_cogl->bounding_redraw_clip.width == 0)
/* NB: a NULL redraw clip == full stage redraw */
if (!stage_cogl->redraw_clip)
have_clip = FALSE;
else
{
redraw_clip = stage_cogl->bounding_redraw_clip;
_clutter_util_rectangle_intersection (&redraw_clip,
&view_rect,
&redraw_clip);
cairo_region_t *view_region;
redraw_clip = cairo_region_copy (stage_cogl->redraw_clip);
have_clip = !(redraw_clip.x == view_rect.x &&
redraw_clip.y == view_rect.y &&
redraw_clip.width == view_rect.width &&
redraw_clip.height == view_rect.height);
view_region = cairo_region_create_rectangle (&view_rect);
cairo_region_intersect (redraw_clip, view_region);
have_clip = !cairo_region_equal (redraw_clip, view_region);
cairo_region_destroy (view_region);
}
may_use_clipped_redraw = FALSE;
@@ -590,24 +547,12 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
cogl_onscreen_get_frame_counter (COGL_ONSCREEN (fb)) > 3)
{
may_use_clipped_redraw = TRUE;
if (fb_scale != floorf (fb_scale))
subpixel_compensation = ceilf (fb_scale);
fb_clip_region = (cairo_rectangle_int_t) {
.x = (floorf ((redraw_clip.x - view_rect.x) * fb_scale) -
subpixel_compensation),
.y = (floorf ((redraw_clip.y - view_rect.y) * fb_scale) -
subpixel_compensation),
.width = (ceilf (redraw_clip.width * fb_scale) +
(2 * subpixel_compensation)),
.height = (ceilf (redraw_clip.height * fb_scale) +
(2 * subpixel_compensation))
};
clip_region = cairo_region_reference (redraw_clip);
}
else
{
fb_clip_region = (cairo_rectangle_int_t) { 0 };
clip_region = cairo_region_create ();
redraw_clip = cairo_region_reference (clip_region);
}
if (may_use_clipped_redraw &&
@@ -616,7 +561,9 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
else
use_clipped_redraw = FALSE;
clip_region_empty = may_use_clipped_redraw && fb_clip_region.width == 0;
clip_region_empty = may_use_clipped_redraw && cairo_region_is_empty (clip_region);
fb_scale = clutter_stage_view_get_scale (view);
swap_with_damage = FALSE;
if (has_buffer_age)
@@ -624,44 +571,26 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
if (use_clipped_redraw && !clip_region_empty)
{
int age, i;
cairo_rectangle_int_t *current_fb_damage =
&view_priv->damage_history[DAMAGE_HISTORY (view_priv->damage_index++)];
age = cogl_onscreen_get_buffer_age (COGL_ONSCREEN (fb));
if (valid_buffer_age (view_cogl, age))
{
cairo_rectangle_int_t damage_region;
*current_fb_damage = fb_clip_region;
fill_current_damage_history (view, clip_region);
for (i = 1; i <= age; i++)
{
cairo_rectangle_int_t *fb_damage =
&view_priv->damage_history[DAMAGE_HISTORY (view_priv->damage_index - i - 1)];
_clutter_util_rectangle_union (&fb_clip_region,
fb_damage,
&fb_clip_region);
cairo_region_t *damage =
view_priv->damage_history[DAMAGE_HISTORY (view_priv->damage_index - i - 1)];
cairo_region_union (clip_region, damage);
}
/* Update the bounding redraw clip state with the extra damage. */
damage_region = (cairo_rectangle_int_t) {
.x = view_rect.x + floorf (fb_clip_region.x / fb_scale),
.y = view_rect.y + floorf (fb_clip_region.y / fb_scale),
.width = ceilf (fb_clip_region.width / fb_scale),
.height = ceilf (fb_clip_region.height / fb_scale)
};
_clutter_util_rectangle_union (&stage_cogl->bounding_redraw_clip,
&damage_region,
&stage_cogl->bounding_redraw_clip);
/* Update the redraw clip state with the extra damage. */
cairo_region_union (stage_cogl->redraw_clip, clip_region);
CLUTTER_NOTE (CLIPPING, "Reusing back buffer(age=%d) - repairing region: x=%d, y=%d, width=%d, height=%d\n",
CLUTTER_NOTE (CLIPPING, "Reusing back buffer(age=%d) - repairing region: num rects: %d\n",
age,
fb_clip_region.x,
fb_clip_region.y,
fb_clip_region.width,
fb_clip_region.height);
cairo_region_num_rectangles (clip_region));
swap_with_damage = TRUE;
}
@@ -669,20 +598,17 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
{
CLUTTER_NOTE (CLIPPING, "Invalid back buffer(age=%d): forcing full redraw\n", age);
use_clipped_redraw = FALSE;
*current_fb_damage = (cairo_rectangle_int_t) {
.x = 0,
.y = 0,
.width = view_rect.width * fb_scale,
.height = view_rect.height * fb_scale
};
fill_current_damage_history_rectangle (view, &view_rect);
}
}
else if (!use_clipped_redraw)
{
fill_current_damage_history_and_step (view);
fill_current_damage_history_rectangle (view, &view_rect);
}
}
cairo_region_get_extents (clip_region, &clip_rect);
cogl_push_framebuffer (fb);
if (use_clipped_redraw && clip_region_empty)
{
@@ -690,34 +616,26 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
}
else if (use_clipped_redraw)
{
cairo_rectangle_int_t scissor_rect;
calculate_scissor_region (&fb_clip_region,
subpixel_compensation,
fb_width, fb_height,
&scissor_rect);
int scissor_x;
int scissor_y;
CLUTTER_NOTE (CLIPPING,
"Stage clip pushed: x=%d, y=%d, width=%d, height=%d\n",
scissor_rect.x,
scissor_rect.y,
scissor_rect.width,
scissor_rect.height);
clip_rect.x,
clip_rect.y,
clip_rect.width,
clip_rect.height);
stage_cogl->using_clipped_redraw = TRUE;
scissor_x = (clip_rect.x - view_rect.x) * fb_scale;
scissor_y = (clip_rect.y - view_rect.y) * fb_scale;
cogl_framebuffer_push_scissor_clip (fb,
scissor_rect.x,
scissor_rect.y,
scissor_rect.width,
scissor_rect.height);
paint_stage (stage_cogl, view,
&(cairo_rectangle_int_t) {
.x = view_rect.x + floorf ((fb_clip_region.x - 0) / fb_scale),
.y = view_rect.y + floorf ((fb_clip_region.y - 0) / fb_scale),
.width = ceilf ((fb_clip_region.width + 0) / fb_scale),
.height = ceilf ((fb_clip_region.height + 0) / fb_scale)
});
scissor_x,
scissor_y,
clip_rect.width * fb_scale,
clip_rect.height * fb_scale);
paint_stage (stage_cogl, view, clip_region);
cogl_framebuffer_pop_clip (fb);
stage_cogl->using_clipped_redraw = FALSE;
@@ -727,47 +645,47 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
CLUTTER_NOTE (CLIPPING, "Unclipped stage paint\n");
/* If we are trying to debug redraw issues then we want to pass
* the bounding_redraw_clip so it can be visualized */
* the redraw_clip so it can be visualized */
if (G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS) &&
may_use_clipped_redraw &&
!clip_region_empty)
{
cairo_rectangle_int_t scissor_rect;
calculate_scissor_region (&fb_clip_region,
subpixel_compensation,
fb_width, fb_height,
&scissor_rect);
int scissor_x;
int scissor_y;
scissor_x = (clip_rect.x - view_rect.x) * fb_scale;;
scissor_y = (clip_rect.y - view_rect.y) * fb_scale;
cogl_framebuffer_push_scissor_clip (fb,
scissor_rect.x,
scissor_rect.y,
scissor_rect.width,
scissor_rect.height);
paint_stage (stage_cogl, view,
&(cairo_rectangle_int_t) {
.x = view_rect.x + floorf (fb_clip_region.x / fb_scale),
.y = view_rect.y + floorf (fb_clip_region.y / fb_scale),
.width = ceilf (fb_clip_region.width / fb_scale),
.height = ceilf (fb_clip_region.height / fb_scale)
});
scissor_x,
scissor_y,
clip_rect.width * fb_scale,
clip_rect.height * fb_scale);
paint_stage (stage_cogl, view, clip_region);
cogl_framebuffer_pop_clip (fb);
}
else
paint_stage (stage_cogl, view, &view_rect);
{
cairo_region_t *view_region;
view_region = cairo_region_create_rectangle (&view_rect);
paint_stage (stage_cogl, view, view_region);
cairo_region_destroy (view_region);
}
}
cogl_pop_framebuffer ();
cairo_region_get_extents (redraw_clip, &redraw_rect);
if (may_use_clipped_redraw &&
G_UNLIKELY ((clutter_paint_debug_flags & CLUTTER_DEBUG_REDRAWS)))
{
CoglContext *ctx = cogl_framebuffer_get_context (fb);
static CoglPipeline *outline = NULL;
ClutterActor *actor = CLUTTER_ACTOR (wrapper);
float x_1 = redraw_clip.x;
float x_2 = redraw_clip.x + redraw_clip.width;
float y_1 = redraw_clip.y;
float y_2 = redraw_clip.y + redraw_clip.height;
float x_1 = redraw_rect.x;
float x_2 = redraw_rect.x + redraw_rect.width;
float y_1 = redraw_rect.y;
float y_2 = redraw_rect.y + redraw_rect.height;
CoglVertexP2 quad[4] = {
{ x_1, y_1 },
{ x_2, y_1 },
@@ -813,7 +731,12 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
}
else if (use_clipped_redraw)
{
swap_region = fb_clip_region;
swap_region = (cairo_rectangle_int_t) {
.x = (clip_rect.x - view_rect.x) * fb_scale,
.y = (clip_rect.y - view_rect.y) * fb_scale,
.width = clip_rect.width * fb_scale,
.height = clip_rect.height * fb_scale,
};
g_assert (swap_region.width > 0);
do_swap_buffer = TRUE;
}
@@ -834,6 +757,11 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
do_swap_buffer = TRUE;
}
if (redraw_clip)
cairo_region_destroy (redraw_clip);
if (clip_region)
cairo_region_destroy (clip_region);
if (do_swap_buffer)
{
if (clutter_stage_view_get_onscreen (view) !=
@@ -881,6 +809,7 @@ clutter_stage_cogl_redraw (ClutterStageWindow *stage_window)
/* reset the redraw clipping for the next paint... */
stage_cogl->initialized_redraw_clip = FALSE;
g_clear_pointer (&stage_cogl->redraw_clip, cairo_region_destroy);
stage_cogl->frame_count++;
}
@@ -895,25 +824,9 @@ clutter_stage_cogl_get_dirty_pixel (ClutterStageWindow *stage_window,
gboolean has_buffer_age =
cogl_is_onscreen (framebuffer) &&
cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_BUFFER_AGE);
float fb_scale;
gboolean scale_is_fractional;
cairo_rectangle_int_t rect;
fb_scale = clutter_stage_view_get_scale (view);
if (fb_scale != floorf (fb_scale))
scale_is_fractional = TRUE;
else
scale_is_fractional = FALSE;
/*
* Buffer damage is tracked in the framebuffer coordinate space
* using the damage history. When fractional scaling is used, a
* coordinate on the stage might not correspond to the exact position of any
* physical pixel, which causes issues when painting using the pick mode.
*
* For now, always use the (0, 0) pixel for picking when using fractional
* framebuffer scaling.
*/
if (!has_buffer_age || scale_is_fractional)
if (!has_buffer_age)
{
*x = 0;
*y = 0;
@@ -924,13 +837,18 @@ clutter_stage_cogl_get_dirty_pixel (ClutterStageWindow *stage_window,
ClutterStageViewCoglPrivate *view_priv =
clutter_stage_view_cogl_get_instance_private (view_cogl);
cairo_rectangle_int_t view_layout;
cairo_rectangle_int_t *fb_damage;
cairo_region_t *damage;
clutter_stage_view_get_layout (view, &view_layout);
fb_damage = &view_priv->damage_history[DAMAGE_HISTORY (view_priv->damage_index - 1)];
*x = fb_damage->x / fb_scale;
*y = fb_damage->y / fb_scale;
damage = view_priv->damage_history[DAMAGE_HISTORY (view_priv->damage_index - 1)];
if (damage)
cairo_region_get_rectangle (damage, 0, &rect);
else
rect.x = rect.y = 0;
*x = rect.x - view_layout.x;
*y = rect.y - view_layout.y;
}
}
@@ -949,7 +867,7 @@ clutter_stage_window_iface_init (ClutterStageWindowIface *iface)
iface->add_redraw_clip = clutter_stage_cogl_add_redraw_clip;
iface->has_redraw_clips = clutter_stage_cogl_has_redraw_clips;
iface->ignoring_redraw_clips = clutter_stage_cogl_ignoring_redraw_clips;
iface->get_redraw_clip_bounds = clutter_stage_cogl_get_redraw_clip_bounds;
iface->get_redraw_clip = clutter_stage_cogl_get_redraw_clip;
iface->redraw = clutter_stage_cogl_redraw;
iface->get_dirty_pixel = clutter_stage_cogl_get_dirty_pixel;
}

View File

@@ -59,7 +59,7 @@ struct _ClutterStageCogl
* junk frames to start with. */
unsigned int frame_count;
cairo_rectangle_int_t bounding_redraw_clip;
cairo_region_t *redraw_clip;
guint initialized_redraw_clip : 1;

View File

@@ -163,9 +163,6 @@ clutter_input_device_evdev_update_from_tool (ClutterInputDevice *device,
if (libinput_tablet_tool_has_slider (evdev_tool->tool))
_clutter_input_device_add_axis (device, CLUTTER_INPUT_AXIS_SLIDER, -1, 1, 0);
if (libinput_tablet_tool_has_wheel (evdev_tool->tool))
_clutter_input_device_add_axis (device, CLUTTER_INPUT_AXIS_WHEEL, -180, 180, 0);
g_object_thaw_notify (G_OBJECT (device));
}

View File

@@ -66,14 +66,6 @@ static const char *clutter_input_axis_atom_names[] = {
#define N_AXIS_ATOMS G_N_ELEMENTS (clutter_input_axis_atom_names)
enum {
PAD_AXIS_FIRST = 3, /* First axes are always x/y/pressure, ignored in pads */
PAD_AXIS_STRIP1 = PAD_AXIS_FIRST,
PAD_AXIS_STRIP2,
PAD_AXIS_RING1,
PAD_AXIS_RING2,
};
static Atom clutter_input_axis_atoms[N_AXIS_ATOMS] = { 0, };
static void clutter_event_translator_iface_init (ClutterEventTranslatorIface *iface);
@@ -367,36 +359,6 @@ get_device_node_path (ClutterBackendX11 *backend_x11,
return node_path;
}
static void
get_pad_features (XIDeviceInfo *info,
guint *n_rings,
guint *n_strips)
{
gint i, rings = 0, strips = 0;
for (i = PAD_AXIS_FIRST; i < info->num_classes; i++)
{
XIValuatorClassInfo *valuator = (XIValuatorClassInfo*) info->classes[i];
int axis = valuator->number;
if (valuator->type != XIValuatorClass)
continue;
if (valuator->max <= 1)
continue;
/* Ring/strip axes are fixed in pad devices as handled by the
* wacom driver. Match those to detect pad features.
*/
if (axis == PAD_AXIS_STRIP1 || axis == PAD_AXIS_STRIP2)
strips++;
else if (axis == PAD_AXIS_RING1 || axis == PAD_AXIS_RING2)
rings++;
}
*n_rings = rings;
*n_strips = strips;
}
static ClutterInputDevice *
create_device (ClutterDeviceManagerXI2 *manager_xi2,
ClutterBackendX11 *backend_x11,
@@ -406,7 +368,7 @@ create_device (ClutterDeviceManagerXI2 *manager_xi2,
ClutterInputDevice *retval;
ClutterInputMode mode;
gboolean is_enabled;
guint num_touches = 0, num_rings = 0, num_strips = 0;
guint num_touches = 0;
gchar *vendor_id = NULL, *product_id = NULL, *node_path = NULL;
if (info->use == XIMasterKeyboard || info->use == XISlaveKeyboard)
@@ -474,12 +436,6 @@ create_device (ClutterDeviceManagerXI2 *manager_xi2,
node_path = get_device_node_path (backend_x11, info);
}
if (source == CLUTTER_PAD_DEVICE)
{
is_enabled = TRUE;
get_pad_features (info, &num_rings, &num_strips);
}
retval = g_object_new (CLUTTER_TYPE_INPUT_DEVICE_XI2,
"name", info->name,
"id", info->deviceid,
@@ -492,8 +448,6 @@ create_device (ClutterDeviceManagerXI2 *manager_xi2,
"vendor-id", vendor_id,
"product-id", product_id,
"device-node", node_path,
"n-rings", num_rings,
"n-strips", num_strips,
NULL);
translate_device_classes (backend_x11->xdpy, retval,
@@ -893,54 +847,6 @@ translate_axes (ClutterInputDevice *device,
return retval;
}
static gboolean
translate_pad_axis (ClutterInputDevice *device,
XIValuatorState *valuators,
ClutterEventType *evtype,
guint *number,
gdouble *value)
{
double *values;
gint i;
values = valuators->values;
for (i = PAD_AXIS_FIRST; i < valuators->mask_len * 8; i++)
{
gdouble val;
guint axis_number = 0;
if (!XIMaskIsSet (valuators->mask, i))
continue;
val = *values++;
if (val <= 0)
continue;
_clutter_input_device_translate_axis (device, i, val, value);
if (i == PAD_AXIS_RING1 || i == PAD_AXIS_RING2)
{
*evtype = CLUTTER_PAD_RING;
(*value) *= 360.0;
}
else if (i == PAD_AXIS_STRIP1 || i == PAD_AXIS_STRIP2)
{
*evtype = CLUTTER_PAD_STRIP;
}
else
continue;
if (i == PAD_AXIS_STRIP2 || i == PAD_AXIS_RING2)
axis_number++;
*number = axis_number;
return TRUE;
}
return FALSE;
}
static void
translate_coords (ClutterStageX11 *stage_x11,
gdouble event_x,
@@ -1119,54 +1025,6 @@ handle_property_event (ClutterDeviceManagerXI2 *manager_xi2,
}
}
static gboolean
translate_pad_event (ClutterEvent *event,
XIDeviceEvent *xev,
ClutterInputDevice *device)
{
gdouble value;
guint number;
if (!translate_pad_axis (device, &xev->valuators,
&event->any.type,
&number, &value))
return FALSE;
/* When touching a ring/strip a first XI_Motion event
* is generated. Use it to reset the pad state, so
* later events actually have a directionality.
*/
if (xev->evtype == XI_Motion)
value = -1;
if (event->any.type == CLUTTER_PAD_RING)
{
event->pad_ring.ring_number = number;
event->pad_ring.angle = value;
}
else
{
event->pad_strip.strip_number = number;
event->pad_strip.value = value;
}
event->any.time = xev->time;
clutter_event_set_device (event, device);
clutter_event_set_source_device (event, device);
CLUTTER_NOTE (EVENT,
"%s: win:0x%x, device:%d '%s', time:%d "
"(value:%f)",
event->any.type == CLUTTER_PAD_RING
? "pad ring "
: "pad strip",
(unsigned int) stage_x11->xwin,
device->id,
device->device_name,
event->any.time, value);
return TRUE;
}
static ClutterTranslateReturn
clutter_device_manager_xi2_translate_event (ClutterEventTranslator *translator,
gpointer native,
@@ -1348,23 +1206,15 @@ clutter_device_manager_xi2_translate_event (ClutterEventTranslator *translator,
XIAsyncDevice,
xev->time);
event->any.stage = stage;
/* Ignore 4-7 buttons */
if (xev->detail >= 4 && xev->detail <= 7)
{
retval = CLUTTER_TRANSLATE_REMOVE;
return CLUTTER_TRANSLATE_REMOVE;
if (xi_event->evtype == XI_ButtonPress &&
translate_pad_event (event, xev, source_device))
retval = CLUTTER_TRANSLATE_QUEUE;
break;
}
event->any.type =
event->pad_button.type =
(xi_event->evtype == XI_ButtonPress) ? CLUTTER_PAD_BUTTON_PRESS
: CLUTTER_PAD_BUTTON_RELEASE;
event->any.time = xev->time;
event->pad_button.time = xev->time;
event->pad_button.stage = stage;
/* The 4-7 button range is taken as non-existent on pad devices,
* let the buttons above that take over this range.
@@ -1374,7 +1224,6 @@ clutter_device_manager_xi2_translate_event (ClutterEventTranslator *translator,
/* Pad buttons are 0-indexed */
event->pad_button.button = xev->detail - 1;
clutter_event_set_device (event, device);
clutter_event_set_source_device (event, source_device);
CLUTTER_NOTE (EVENT,
@@ -1531,15 +1380,6 @@ clutter_device_manager_xi2_translate_event (ClutterEventTranslator *translator,
device = g_hash_table_lookup (manager_xi2->devices_by_id,
GINT_TO_POINTER (xev->deviceid));
if (clutter_input_device_get_device_type (source_device) == CLUTTER_PAD_DEVICE)
{
event->any.stage = stage;
if (translate_pad_event (event, xev, source_device))
retval = CLUTTER_TRANSLATE_QUEUE;
break;
}
/* Set the stage for core events coming out of nowhere (see bug #684509) */
if (clutter_input_device_get_device_mode (device) == CLUTTER_INPUT_MODE_MASTER &&
clutter_input_device_get_pointer_stage (device) == NULL &&

View File

@@ -10,6 +10,7 @@ static const struct {
{ "Net/DndDragThreshold", "dnd-drag-threshold" },
{ "Gtk/FontName", "font-name" },
{ "Xft/Antialias", "font-antialias" },
{ "Xft/DPI", "font-dpi" },
{ "Xft/Hinting", "font-hinting" },
{ "Xft/HintStyle", "font-hint-style" },
{ "Xft/RGBA", "font-subpixel-order" },

View File

@@ -110,7 +110,7 @@ LT_LIB_M
AC_HEADER_STDC
# required versions for dependencies
m4_define([glib_req_version], [2.53.2])
m4_define([glib_req_version], [2.44.0])
m4_define([cogl_req_version], [1.21.2])
m4_define([json_glib_req_version], [0.12.0])
m4_define([atk_req_version], [2.5.3])

View File

@@ -407,7 +407,8 @@ test_scale_center (TestState *state)
g_assert (scale_x == 4.0);
g_assert (scale_y == 2.0);
g_assert (gravity == CLUTTER_GRAVITY_NONE);
assert_notifications (NOTIFY_SCALE_CENTER_X | NOTIFY_SCALE_CENTER_Y
assert_notifications (NOTIFY_SCALE_X | NOTIFY_SCALE_Y
| NOTIFY_SCALE_CENTER_X | NOTIFY_SCALE_CENTER_Y
| NOTIFY_SCALE_GRAVITY);
assert_coords (state, 100 + 10 - 10 * 4, 200 + 20 - 20 * 2,
100 + 10 + (RECT_WIDTH - 10) * 4,

View File

@@ -193,6 +193,11 @@ struct _CoglFramebuffer
CoglFramebufferBits bits;
int samples_per_pixel;
/* Whether the depth buffer was enabled for this framebuffer,
* usually means it needs to be cleared before being reused next.
*/
CoglBool depth_buffer_clear_needed;
};
typedef enum {

View File

@@ -117,6 +117,7 @@ _cogl_framebuffer_init (CoglFramebuffer *framebuffer,
framebuffer->viewport_age_for_scissor_workaround = -1;
framebuffer->dither_enabled = TRUE;
framebuffer->depth_writing_enabled = TRUE;
framebuffer->depth_buffer_clear_needed = TRUE;
framebuffer->modelview_stack = cogl_matrix_stack_new (ctx);
framebuffer->projection_stack = cogl_matrix_stack_new (ctx);
@@ -268,6 +269,13 @@ cogl_framebuffer_clear4f (CoglFramebuffer *framebuffer,
int scissor_y1;
CoglBool saved_viewport_scissor_workaround;
if (!framebuffer->depth_buffer_clear_needed &&
(buffers & COGL_BUFFER_BIT_DEPTH))
buffers &= ~(COGL_BUFFER_BIT_DEPTH);
if (buffers == 0)
return;
_cogl_clip_stack_get_bounds (clip_stack,
&scissor_x0, &scissor_y0,
&scissor_x1, &scissor_y1);
@@ -415,6 +423,9 @@ cleared:
_cogl_framebuffer_mark_mid_scene (framebuffer);
_cogl_framebuffer_mark_clear_clip_dirty (framebuffer);
if (buffers & COGL_BUFFER_BIT_DEPTH)
framebuffer->depth_buffer_clear_needed = FALSE;
if (buffers & COGL_BUFFER_BIT_COLOR && buffers & COGL_BUFFER_BIT_DEPTH)
{
/* For our fast-path for reading back a single pixel of simple

View File

@@ -418,7 +418,11 @@ flush_depth_state (CoglContext *ctx,
if (ctx->depth_test_enabled_cache != depth_state->test_enabled)
{
if (depth_state->test_enabled == TRUE)
GE (ctx, glEnable (GL_DEPTH_TEST));
{
GE (ctx, glEnable (GL_DEPTH_TEST));
if (ctx->current_draw_buffer)
ctx->current_draw_buffer->depth_buffer_clear_needed = TRUE;
}
else
GE (ctx, glDisable (GL_DEPTH_TEST));
ctx->depth_test_enabled_cache = depth_state->test_enabled;

View File

@@ -2,7 +2,7 @@ AC_PREREQ(2.62)
m4_define([mutter_major_version], [3])
m4_define([mutter_minor_version], [25])
m4_define([mutter_micro_version], [4])
m4_define([mutter_micro_version], [1])
m4_define([mutter_version],
[mutter_major_version.mutter_minor_version.mutter_micro_version])
@@ -72,7 +72,7 @@ AC_HEADER_STDC
PKG_PROG_PKG_CONFIG([0.21])
# Sets GLIB_GENMARSHAL and GLIB_MKENUMS
AM_PATH_GLIB_2_0([2.53.2])
AM_PATH_GLIB_2_0([2.49.0])
CANBERRA_GTK=libcanberra-gtk3
CANBERRA_GTK_VERSION=0.26

View File

@@ -103,7 +103,7 @@
</key>
<key name="experimental-features" type="as">
<default>['monitor-config-manager']</default>
<default>[]</default>
<summary>Enable experimental features</summary>
<description>
To enable experimental features, add the feature keyword to the list.
@@ -114,22 +114,12 @@
Currently possible keywords:
• “monitor-config-manager” — use the new monitor configuration
system, aimed to replace the old one.
This enables a higher level configuration
API to be used by configuration
applications, as well as the ability to
configure per logical monitor scale.
• “scale-monitor-framebuffer” — makes mutter default to layout logical
monitors in a logical pixel coordinate
space, while scaling monitor
framebuffers instead of window content,
to manage HiDPI monitors. Does not
require a restart.
Also enabling “monitor-config-manager”
is required for this feature to be
enabled.
</description>
</key>
@@ -156,15 +146,5 @@
<summary>Cancel tab popup</summary>
</key>
<key name="switch-monitor" type="as">
<default><![CDATA[['<Super>p','XF86Display']]]></default>
<summary>Switch monitor configurations</summary>
</key>
<key name="rotate-monitor" type="as">
<default><![CDATA[['XF86RotateWindows']]]></default>
<summary>Rotates the built-in monitor configuration</summary>
</key>
</schema>
</schemalist>

413
po/ar.po
View File

@@ -4,15 +4,14 @@
# Arafat Medini <lumina@silverpen.de>, 2003.
# Abdulaziz Al-Arfaj <alarfaj0@yahoo.com>, 2004.
# Djihed Afifi <djihed@gmail.com>, 2006.
# Khaled Hosny <khaledhosny@eglug.org>, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2017.
# Khaled Hosny <khaledhosny@eglug.org>, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015.
# Anas Afif Emad <anas.e87@gmail.com>, 2008.
msgid ""
msgstr ""
"Project-Id-Version: metacity.HEAD\n"
"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?product=mutter&"
"keywords=I18N+L10N&component=general\n"
"POT-Creation-Date: 2017-06-18 21:26+0200\n"
"PO-Revision-Date: 2017-06-18 21:27+0200\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-03-23 21:38+0200\n"
"PO-Revision-Date: 2015-03-23 21:45+0200\n"
"Last-Translator: Khaled Hosny <khaledhosny@eglug.org>\n"
"Language-Team: Arabic <doc@arabeyes.org>\n"
"Language: ar\n"
@@ -21,568 +20,524 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 "
"&& n%100<=10 ? 3 : n%100>=11 ? 4 : 5;\n"
"X-Generator: Virtaal 1.0.0-beta1\n"
"X-Project-Style: gnome\n"
"X-Generator: Virtaal 0.7.1\n"
#: data/50-mutter-navigation.xml:6
#: ../data/50-mutter-navigation.xml.in.h:1
msgid "Navigation"
msgstr "الإبحار"
#: data/50-mutter-navigation.xml:9
#: ../data/50-mutter-navigation.xml.in.h:2
msgid "Move window to workspace 1"
msgstr "انقل النافذة إلى مساحة العمل 1"
#: data/50-mutter-navigation.xml:12
#: ../data/50-mutter-navigation.xml.in.h:3
msgid "Move window to workspace 2"
msgstr "انقل النافذة إلى مساحة العمل 2"
#: data/50-mutter-navigation.xml:15
#: ../data/50-mutter-navigation.xml.in.h:4
msgid "Move window to workspace 3"
msgstr "انقل النافذة إلى مساحة العمل 3"
#: data/50-mutter-navigation.xml:18
#: ../data/50-mutter-navigation.xml.in.h:5
msgid "Move window to workspace 4"
msgstr "انقل النافذة إلى مساحة العمل 4"
#: data/50-mutter-navigation.xml:21
#: ../data/50-mutter-navigation.xml.in.h:6
msgid "Move window to last workspace"
msgstr "انقل النافذة إلى مساحة العمل الأخيرة"
#: data/50-mutter-navigation.xml:24
#: ../data/50-mutter-navigation.xml.in.h:7
msgid "Move window one workspace to the left"
msgstr "انقل النافذة مساحة عمل واحدة إلى اليسار"
#: data/50-mutter-navigation.xml:27
#: ../data/50-mutter-navigation.xml.in.h:8
msgid "Move window one workspace to the right"
msgstr "انقل النافذة مساحة عمل واحدة إلى اليمين"
#: data/50-mutter-navigation.xml:30
#: ../data/50-mutter-navigation.xml.in.h:9
msgid "Move window one workspace up"
msgstr "انقل النافذة مساحة عمل واحدة إلى الأعلى"
#: data/50-mutter-navigation.xml:33
#: ../data/50-mutter-navigation.xml.in.h:10
msgid "Move window one workspace down"
msgstr "انقل النافذة مساحة عمل واحدة إلى الأسفل"
#: data/50-mutter-navigation.xml:36
#: ../data/50-mutter-navigation.xml.in.h:11
msgid "Move window one monitor to the left"
msgstr "انقل النافذة شاشة واحدة إلى اليسار"
#: data/50-mutter-navigation.xml:39
#: ../data/50-mutter-navigation.xml.in.h:12
msgid "Move window one monitor to the right"
msgstr "انقل النافذة شاشة واحدة إلى اليمين"
#: data/50-mutter-navigation.xml:42
#: ../data/50-mutter-navigation.xml.in.h:13
msgid "Move window one monitor up"
msgstr "انقل النافذة شاشة واحدة إلى الأعلى"
#: data/50-mutter-navigation.xml:45
#: ../data/50-mutter-navigation.xml.in.h:14
msgid "Move window one monitor down"
msgstr "انقل النافذة شاشة واحدة إلى الأسفل"
#: data/50-mutter-navigation.xml:49
#: ../data/50-mutter-navigation.xml.in.h:15
msgid "Switch applications"
msgstr "تنقل بين التطبيقات"
#: data/50-mutter-navigation.xml:54
#: ../data/50-mutter-navigation.xml.in.h:16
msgid "Switch to previous application"
msgstr "انتقل إلى التطبيق السابق"
#: data/50-mutter-navigation.xml:58
#: ../data/50-mutter-navigation.xml.in.h:17
msgid "Switch windows"
msgstr "تنقل بين النوافذ"
#: data/50-mutter-navigation.xml:63
#: ../data/50-mutter-navigation.xml.in.h:18
msgid "Switch to previous window"
msgstr "انتقل إلى النافذة السابقة"
#: data/50-mutter-navigation.xml:67
#: ../data/50-mutter-navigation.xml.in.h:19
msgid "Switch windows of an application"
msgstr "تنقل بين نوافذ التطبيق"
#: data/50-mutter-navigation.xml:72
#: ../data/50-mutter-navigation.xml.in.h:20
msgid "Switch to previous window of an application"
msgstr "انتقل إلى نافذة التطبيق السابقة"
#: data/50-mutter-navigation.xml:76
#: ../data/50-mutter-navigation.xml.in.h:21
msgid "Switch system controls"
msgstr "تنقل بين تحكمات النظام"
#: data/50-mutter-navigation.xml:81
#: ../data/50-mutter-navigation.xml.in.h:22
msgid "Switch to previous system control"
msgstr "انتقل إلى تحكم النظام السابق"
#: data/50-mutter-navigation.xml:85
#: ../data/50-mutter-navigation.xml.in.h:23
msgid "Switch windows directly"
msgstr "تنقل مباشرة بين النوافذ"
#: data/50-mutter-navigation.xml:90
#: ../data/50-mutter-navigation.xml.in.h:24
msgid "Switch directly to previous window"
msgstr "انتقل مباشرة إلى النافذة السابقة"
#: data/50-mutter-navigation.xml:94
#: ../data/50-mutter-navigation.xml.in.h:25
msgid "Switch windows of an app directly"
msgstr "تنقل مباشرة بين نوافذ التطبيق"
#: data/50-mutter-navigation.xml:99
#: ../data/50-mutter-navigation.xml.in.h:26
msgid "Switch directly to previous window of an app"
msgstr "انتقل مباشرة إلى نافذة التطبيق السابقة"
#: data/50-mutter-navigation.xml:103
#: ../data/50-mutter-navigation.xml.in.h:27
msgid "Switch system controls directly"
msgstr "تنقل مباشرة بين تحكمات النظام"
#: data/50-mutter-navigation.xml:108
#: ../data/50-mutter-navigation.xml.in.h:28
msgid "Switch directly to previous system control"
msgstr "انتقل مباشرة إلى تحكم النظام السابق"
#: data/50-mutter-navigation.xml:111
#: ../data/50-mutter-navigation.xml.in.h:29
msgid "Hide all normal windows"
msgstr "أخفِ كل النوافذ العادية"
#: data/50-mutter-navigation.xml:114
#: ../data/50-mutter-navigation.xml.in.h:30
msgid "Switch to workspace 1"
msgstr "انتقل إلى مساحة العمل 1"
#: data/50-mutter-navigation.xml:117
#: ../data/50-mutter-navigation.xml.in.h:31
msgid "Switch to workspace 2"
msgstr "انتقل إلى مساحة العمل 2"
#: data/50-mutter-navigation.xml:120
#: ../data/50-mutter-navigation.xml.in.h:32
msgid "Switch to workspace 3"
msgstr "انتقل إلى مساحة العمل 3"
#: data/50-mutter-navigation.xml:123
#: ../data/50-mutter-navigation.xml.in.h:33
msgid "Switch to workspace 4"
msgstr "انتقل إلى مساحة العمل 4"
#: data/50-mutter-navigation.xml:126
#: ../data/50-mutter-navigation.xml.in.h:34
msgid "Switch to last workspace"
msgstr "انتقل إلى مساحة العمل الأخيرة"
#: data/50-mutter-navigation.xml:129
#: ../data/50-mutter-navigation.xml.in.h:35
msgid "Move to workspace left"
msgstr "انقل لمساحة العمل على اليسار"
#: data/50-mutter-navigation.xml:132
#: ../data/50-mutter-navigation.xml.in.h:36
msgid "Move to workspace right"
msgstr "انقل لمساحة العمل على اليمين"
#: data/50-mutter-navigation.xml:135
#: ../data/50-mutter-navigation.xml.in.h:37
msgid "Move to workspace above"
msgstr "انقل لمساحة العمل أعلى"
#: data/50-mutter-navigation.xml:138
#: ../data/50-mutter-navigation.xml.in.h:38
msgid "Move to workspace below"
msgstr "انقل لمساحة العمل أسفل"
#: data/50-mutter-system.xml:6
#: ../data/50-mutter-system.xml.in.h:1
msgid "System"
msgstr "النظام"
#: data/50-mutter-system.xml:8
#: ../data/50-mutter-system.xml.in.h:2
msgid "Show the run command prompt"
msgstr "أظهر محث تشغيل أمر"
#: data/50-mutter-system.xml:10
#: ../data/50-mutter-system.xml.in.h:3
msgid "Show the activities overview"
msgstr "أظهر نظرة عامة على الأنشطة"
#: data/50-mutter-windows.xml:6
#: ../data/50-mutter-windows.xml.in.h:1
msgid "Windows"
msgstr "النوافذ"
#: data/50-mutter-windows.xml:8
#: ../data/50-mutter-windows.xml.in.h:2
msgid "Activate the window menu"
msgstr "فعّل قائمة النافذة"
#: data/50-mutter-windows.xml:10
#: ../data/50-mutter-windows.xml.in.h:3
msgid "Toggle fullscreen mode"
msgstr "بدّل نمط ملء الشاشة"
#: data/50-mutter-windows.xml:12
#: ../data/50-mutter-windows.xml.in.h:4
msgid "Toggle maximization state"
msgstr "بدّل حالة التكبير"
#: data/50-mutter-windows.xml:14
#: ../data/50-mutter-windows.xml.in.h:5
msgid "Maximize window"
msgstr "كبّر النّافذة"
#: data/50-mutter-windows.xml:16
#: ../data/50-mutter-windows.xml.in.h:6
msgid "Restore window"
msgstr "استعد النّافذة"
#: data/50-mutter-windows.xml:18
#: ../data/50-mutter-windows.xml.in.h:7
msgid "Toggle shaded state"
msgstr "بدّل حالة الإخفاء"
#: data/50-mutter-windows.xml:20
#: ../data/50-mutter-windows.xml.in.h:8
msgid "Close window"
msgstr "أغلق النّافذة"
#: data/50-mutter-windows.xml:22
#: ../data/50-mutter-windows.xml.in.h:9
msgid "Hide window"
msgstr "أخفِ النّافذة"
#: data/50-mutter-windows.xml:24
#: ../data/50-mutter-windows.xml.in.h:10
msgid "Move window"
msgstr "انقل النّافذة"
#: data/50-mutter-windows.xml:26
#: ../data/50-mutter-windows.xml.in.h:11
msgid "Resize window"
msgstr "حجّم النّافذة"
#: data/50-mutter-windows.xml:29
#: ../data/50-mutter-windows.xml.in.h:12
msgid "Toggle window on all workspaces or one"
msgstr "بدّل حالة ظهور النافذة على جميع مساحات العمل أو واحدة منها"
#: data/50-mutter-windows.xml:31
#: ../data/50-mutter-windows.xml.in.h:13
msgid "Raise window if covered, otherwise lower it"
msgstr "ارفع النافذة إذا كانت أخرى تغطيها، أو أخفضها في ما عدا ذلك"
#: data/50-mutter-windows.xml:33
#: ../data/50-mutter-windows.xml.in.h:14
msgid "Raise window above other windows"
msgstr "ارفع النافذة فوق النوافذ الأخرى"
#: data/50-mutter-windows.xml:35
#: ../data/50-mutter-windows.xml.in.h:15
msgid "Lower window below other windows"
msgstr "اخفض النافذة تحت النوافذ الأخرى"
#: data/50-mutter-windows.xml:37
#: ../data/50-mutter-windows.xml.in.h:16
msgid "Maximize window vertically"
msgstr "كبّر النافذة رأسيا"
#: data/50-mutter-windows.xml:39
#: ../data/50-mutter-windows.xml.in.h:17
msgid "Maximize window horizontally"
msgstr "كبّر النافذة أفقيا"
#: data/50-mutter-windows.xml:43
#: ../data/50-mutter-windows.xml.in.h:18
msgid "View split on left"
msgstr "المنظور مقسوم على اليمين"
#: data/50-mutter-windows.xml:47
#: ../data/50-mutter-windows.xml.in.h:19
msgid "View split on right"
msgstr "المنظور مقسوم على اليسار"
#: data/mutter.desktop.in:4
#: ../data/mutter.desktop.in.h:1
msgid "Mutter"
msgstr "مَتَر"
#: data/org.gnome.mutter.gschema.xml.in:7
#: ../data/org.gnome.mutter.gschema.xml.in.h:1
msgid "Modifier to use for extended window management operations"
msgstr "المغير الذي سيُستعمل لتمديد عمليات إدارة النوافذ "
#: data/org.gnome.mutter.gschema.xml.in:8
#: ../data/org.gnome.mutter.gschema.xml.in.h:2
msgid ""
"This key will initiate the overlay, which is a combination window overview "
"and application launching system. The default is intended to be the “Windows "
"key on PC hardware. Its expected that this binding either the default or "
"set to the empty string."
"This key will initiate the \"overlay\", which is a combination window "
"overview and application launching system. The default is intended to be the "
"\"Windows key\" on PC hardware. It's expected that this binding either the "
"default or set to the empty string."
msgstr ""
#: data/org.gnome.mutter.gschema.xml.in:20
#: ../data/org.gnome.mutter.gschema.xml.in.h:3
msgid "Attach modal dialogs"
msgstr ""
#: data/org.gnome.mutter.gschema.xml.in:21
#: ../data/org.gnome.mutter.gschema.xml.in.h:4
msgid ""
"When true, instead of having independent titlebars, modal dialogs appear "
"attached to the titlebar of the parent window and are moved together with "
"the parent window."
msgstr ""
#: data/org.gnome.mutter.gschema.xml.in:30
#: ../data/org.gnome.mutter.gschema.xml.in.h:5
msgid "Enable edge tiling when dropping windows on screen edges"
msgstr ""
#: data/org.gnome.mutter.gschema.xml.in:31
#: ../data/org.gnome.mutter.gschema.xml.in.h:6
msgid ""
"If enabled, dropping windows on vertical screen edges maximizes them "
"vertically and resizes them horizontally to cover half of the available "
"area. Dropping windows on the top screen edge maximizes them completely."
msgstr ""
#: data/org.gnome.mutter.gschema.xml.in:40
#: ../data/org.gnome.mutter.gschema.xml.in.h:7
msgid "Workspaces are managed dynamically"
msgstr ""
#: data/org.gnome.mutter.gschema.xml.in:41
#: ../data/org.gnome.mutter.gschema.xml.in.h:8
msgid ""
"Determines whether workspaces are managed dynamically or whether theres a "
"Determines whether workspaces are managed dynamically or whether there's a "
"static number of workspaces (determined by the num-workspaces key in org."
"gnome.desktop.wm.preferences)."
msgstr ""
#: data/org.gnome.mutter.gschema.xml.in:50
#: ../data/org.gnome.mutter.gschema.xml.in.h:9
msgid "Workspaces only on primary"
msgstr ""
#: data/org.gnome.mutter.gschema.xml.in:51
#: ../data/org.gnome.mutter.gschema.xml.in.h:10
msgid ""
"Determines whether workspace switching should happen for windows on all "
"monitors or only for windows on the primary monitor."
msgstr ""
#: data/org.gnome.mutter.gschema.xml.in:59
#: ../data/org.gnome.mutter.gschema.xml.in.h:11
msgid "No tab popup"
msgstr ""
#: data/org.gnome.mutter.gschema.xml.in:60
#: ../data/org.gnome.mutter.gschema.xml.in.h:12
msgid ""
"Determines whether the use of popup and highlight frame should be disabled "
"for window cycling."
msgstr ""
#: data/org.gnome.mutter.gschema.xml.in:68
#: ../data/org.gnome.mutter.gschema.xml.in.h:13
msgid "Delay focus changes until the pointer stops moving"
msgstr ""
#: data/org.gnome.mutter.gschema.xml.in:69
#: ../data/org.gnome.mutter.gschema.xml.in.h:14
msgid ""
"If set to true, and the focus mode is either sloppy or mouse then the "
"focus will not be changed immediately when entering a window, but only after "
"the pointer stops moving."
"If set to true, and the focus mode is either \"sloppy\" or \"mouse\" then "
"the focus will not be changed immediately when entering a window, but only "
"after the pointer stops moving."
msgstr ""
#: data/org.gnome.mutter.gschema.xml.in:79
#: ../data/org.gnome.mutter.gschema.xml.in.h:15
msgid "Draggable border width"
msgstr ""
#: data/org.gnome.mutter.gschema.xml.in:80
#: ../data/org.gnome.mutter.gschema.xml.in.h:16
msgid ""
"The amount of total draggable borders. If the themes visible borders are "
"The amount of total draggable borders. If the theme's visible borders are "
"not enough, invisible borders will be added to meet this value."
msgstr ""
#: data/org.gnome.mutter.gschema.xml.in:89
#: ../data/org.gnome.mutter.gschema.xml.in.h:17
msgid "Auto maximize nearly monitor sized windows"
msgstr ""
#: data/org.gnome.mutter.gschema.xml.in:90
#: ../data/org.gnome.mutter.gschema.xml.in.h:18
msgid ""
"If enabled, new windows that are initially the size of the monitor "
"automatically get maximized."
msgstr ""
#: data/org.gnome.mutter.gschema.xml.in:98
#: ../data/org.gnome.mutter.gschema.xml.in.h:19
msgid "Place new windows in the center"
msgstr ""
#: data/org.gnome.mutter.gschema.xml.in:99
#: ../data/org.gnome.mutter.gschema.xml.in.h:20
msgid ""
"When true, the new windows will always be put in the center of the active "
"screen of the monitor."
msgstr ""
#: data/org.gnome.mutter.gschema.xml.in:107
msgid "Enable experimental features"
msgstr ""
#: data/org.gnome.mutter.gschema.xml.in:108
msgid ""
"To enable experimental features, add the feature keyword to the list. "
"Whether the feature requires restarting the compositor depends on the given "
"feature. Any experimental feature is not required to still be available, or "
"configurable. Dont expect adding anything in this setting to be future "
"proof. Currently possible keywords: • “monitor-config-manager” — use the new "
"monitor configuration system, aimed to replace the old one. This enables a "
"higher level configuration API to be used by configuration applications, as "
"well as the ability to configure per logical monitor scale. • “scale-monitor-"
"framebuffer” — makes mutter default to layout logical monitors in a logical "
"pixel coordinate space, while scaling monitor framebuffers instead of window "
"content, to manage HiDPI monitors. Does not require a restart. Also enabling "
"“monitor-config-manager” is required for this feature to be enabled."
msgstr ""
#: data/org.gnome.mutter.gschema.xml.in:151
#: ../data/org.gnome.mutter.gschema.xml.in.h:21
msgid "Select window from tab popup"
msgstr ""
#: data/org.gnome.mutter.gschema.xml.in:156
#: ../data/org.gnome.mutter.gschema.xml.in.h:22
msgid "Cancel tab popup"
msgstr ""
#: data/org.gnome.mutter.wayland.gschema.xml.in:6
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:1
#, fuzzy
msgid "Switch to VT 1"
msgstr "انتقل إلى مساحة العمل 1"
#: data/org.gnome.mutter.wayland.gschema.xml.in:10
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:2
#, fuzzy
msgid "Switch to VT 2"
msgstr "انتقل إلى مساحة العمل 2"
#: data/org.gnome.mutter.wayland.gschema.xml.in:14
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:3
#, fuzzy
msgid "Switch to VT 3"
msgstr "انتقل إلى مساحة العمل 3"
#: data/org.gnome.mutter.wayland.gschema.xml.in:18
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:4
#, fuzzy
msgid "Switch to VT 4"
msgstr "انتقل إلى مساحة العمل 4"
#: data/org.gnome.mutter.wayland.gschema.xml.in:22
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:5
#, fuzzy
msgid "Switch to VT 5"
msgstr "انتقل إلى مساحة العمل 5"
#: data/org.gnome.mutter.wayland.gschema.xml.in:26
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:6
#, fuzzy
msgid "Switch to VT 6"
msgstr "انتقل إلى مساحة العمل 6"
#: data/org.gnome.mutter.wayland.gschema.xml.in:30
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:7
#, fuzzy
msgid "Switch to VT 7"
msgstr "انتقل إلى مساحة العمل 7"
#: data/org.gnome.mutter.wayland.gschema.xml.in:34
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:8
#, fuzzy
msgid "Switch to VT 8"
msgstr "انتقل إلى مساحة العمل 8"
#: data/org.gnome.mutter.wayland.gschema.xml.in:38
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:9
#, fuzzy
msgid "Switch to VT 9"
msgstr "انتقل إلى مساحة العمل 9"
#: data/org.gnome.mutter.wayland.gschema.xml.in:42
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:10
#, fuzzy
msgid "Switch to VT 10"
msgstr "انتقل إلى مساحة العمل 10"
#: data/org.gnome.mutter.wayland.gschema.xml.in:46
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:11
#, fuzzy
msgid "Switch to VT 11"
msgstr "انتقل إلى مساحة العمل 11"
#: data/org.gnome.mutter.wayland.gschema.xml.in:50
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:12
#, fuzzy
msgid "Switch to VT 12"
msgstr "انتقل إلى مساحة العمل 12"
#. TRANSLATORS: This string refers to a button that switches between
#. * different modes.
#.
#: src/backends/meta-input-settings.c:1866
#, c-format
msgid "Mode Switch (Group %d)"
msgstr ""
#. TRANSLATORS: This string refers to an action, cycles drawing tablets'
#. * mapping through the available outputs.
#.
#: src/backends/meta-input-settings.c:1888
msgid "Switch monitor"
msgstr "غيّر الشاشة"
#: src/backends/meta-input-settings.c:1890
msgid "Show on-screen help"
msgstr ""
#: src/backends/meta-monitor-manager.c:879
#: ../src/backends/meta-monitor-manager.c:364
msgid "Built-in display"
msgstr "شاشة مدمجة"
#: src/backends/meta-monitor-manager.c:902
#: ../src/backends/meta-monitor-manager.c:391
msgid "Unknown"
msgstr "غير معروفة"
#: src/backends/meta-monitor-manager.c:904
#: ../src/backends/meta-monitor-manager.c:393
msgid "Unknown Display"
msgstr "شاشة غير معروفة"
#. TRANSLATORS: this is a monitor vendor name, followed by a
#. * size in inches, like 'Dell 15"'
#.
#: src/backends/meta-monitor-manager.c:912
#: ../src/backends/meta-monitor-manager.c:401
#, c-format
msgid "%s %s"
msgstr "%s %s"
#. This probably means that a non-WM compositor like xcompmgr is running;
#. * we have no way to get it to exit
#: src/compositor/compositor.c:476
#, fuzzy, c-format
#: ../src/compositor/compositor.c:456
#, c-format
msgid ""
"Another compositing manager is already running on screen %i on display “%s”."
"Another compositing manager is already running on screen %i on display \"%s"
"\"."
msgstr "يعمل مدير مزج آخر على الشاشة %i والعرض \"%s\"."
#: src/core/bell.c:194
#: ../src/core/bell.c:185
msgid "Bell event"
msgstr "حدث جرس"
#: src/core/display.c:608
#, fuzzy, c-format
msgid "Failed to open X Window System display “%s”\n"
msgstr "فشل فتح عرض نظام نوافذ إكس '%s'\n"
#: src/core/main.c:189
msgid "Disable connection to session manager"
msgstr "عطّل الاتصال بمدير الجلسة"
#: src/core/main.c:195
msgid "Replace the running window manager"
msgstr "استبدل بمدير النوافذ الذي يعمل"
#: src/core/main.c:201
msgid "Specify session management ID"
msgstr "حدّد رقم هويّة إدارة الجلسة"
#: src/core/main.c:206
msgid "X Display to use"
msgstr "معراض س الذي سيستعمل"
#: src/core/main.c:212
msgid "Initialize session from savefile"
msgstr "ابدأ الجلسة من ملف محفوظ"
#: src/core/main.c:218
msgid "Make X calls synchronous"
msgstr "اجعل نداءات س متزامنة"
#: src/core/main.c:225
msgid "Run as a wayland compositor"
msgstr ""
#: src/core/main.c:231
msgid "Run as a nested compositor"
msgstr ""
#: src/core/main.c:239
msgid "Run as a full display server, rather than nested"
msgstr ""
#. Translators: %s is a window title
#: src/core/meta-close-dialog-default.c:147
#: ../src/core/delete.c:127
#, c-format
msgid "“%s” is not responding."
msgstr "”‏%s“ لا يستجيب."
#: src/core/meta-close-dialog-default.c:149
#: ../src/core/delete.c:129
msgid "Application is not responding."
msgstr "لا يستجيب التطبيق"
#: src/core/meta-close-dialog-default.c:154
#: ../src/core/delete.c:134
msgid ""
"You may choose to wait a short while for it to continue or force the "
"application to quit entirely."
msgstr "ربما ترغب في الانتظار قليلا ليُكمِل أو إجبار التطبيق على الإنهاء كُلّية."
#: src/core/meta-close-dialog-default.c:161
msgid "_Force Quit"
msgstr "أ_جبر الإنهاء"
#: src/core/meta-close-dialog-default.c:161
#: ../src/core/delete.c:141
msgid "_Wait"
msgstr "ا_نتظر"
#: src/core/mutter.c:39
#, fuzzy, c-format
#: ../src/core/delete.c:141
msgid "_Force Quit"
msgstr "أ_جبر الإنهاء"
#: ../src/core/display.c:562
#, c-format
msgid "Failed to open X Window System display '%s'\n"
msgstr "فشل فتح عرض نظام نوافذ إكس '%s'\n"
#: ../src/core/main.c:176
msgid "Disable connection to session manager"
msgstr "عطّل الاتصال بمدير الجلسة"
#: ../src/core/main.c:182
msgid "Replace the running window manager"
msgstr "استبدل بمدير النوافذ الذي يعمل"
#: ../src/core/main.c:188
msgid "Specify session management ID"
msgstr "حدّد رقم هويّة إدارة الجلسة"
#: ../src/core/main.c:193
msgid "X Display to use"
msgstr "معراض س الذي سيستعمل"
#: ../src/core/main.c:199
msgid "Initialize session from savefile"
msgstr "ابدأ الجلسة من ملف محفوظ"
#: ../src/core/main.c:205
msgid "Make X calls synchronous"
msgstr "اجعل نداءات س متزامنة"
#: ../src/core/main.c:212
msgid "Run as a wayland compositor"
msgstr ""
#: ../src/core/main.c:220
msgid "Run as a full display server, rather than nested"
msgstr ""
#: ../src/core/mutter.c:39
#, c-format
msgid ""
"mutter %s\n"
"Copyright © 2001-%d Havoc Pennington, Red Hat, Inc., and others\n"
"Copyright (C) 2001-%d Havoc Pennington, Red Hat, Inc., and others\n"
"This is free software; see the source for copying conditions.\n"
"There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A "
"PARTICULAR PURPOSE.\n"
@@ -592,52 +547,46 @@ msgstr ""
"هذا برنامج حر، راجع المصدر لشروط النسخ.\n"
"لا يوجد أي ضمان: و لا حتى ضمان قابلية التسويق أو المناسبة لأي هدف.\n"
#: src/core/mutter.c:53
#: ../src/core/mutter.c:53
msgid "Print version"
msgstr "اطبع الإصدارة"
#: src/core/mutter.c:59
#: ../src/core/mutter.c:59
msgid "Mutter plugin to use"
msgstr "ملحق مَتَر الذي سيُستخدم"
#: src/core/prefs.c:1997
#: ../src/core/prefs.c:2004
#, c-format
msgid "Workspace %d"
msgstr "مساحة العمل %d"
#: src/core/screen.c:580
#, fuzzy, c-format
#: ../src/core/screen.c:525
#, c-format
msgid ""
"Display “%s” already has a window manager; try using the --replace option to "
"replace the current window manager."
"Display \"%s\" already has a window manager; try using the --replace option "
"to replace the current window manager."
msgstr ""
"الشاشة \"%s\" لها مدير نوافذ بالفعل، حاول استعمال خيار التبديل --replace "
"لتحُلّ محلّ مدير النوافذ الحالي."
#: src/core/screen.c:665
#, fuzzy, c-format
msgid "Screen %d on display %s is invalid\n"
#: ../src/core/screen.c:607
#, c-format
msgid "Screen %d on display '%s' is invalid\n"
msgstr "الشاشة %d على العرض '%s' غير صحيحة\n"
#: src/core/util.c:120
#: ../src/core/util.c:118
msgid "Mutter was compiled without support for verbose mode\n"
msgstr "جُمِّع مَتَر دون دعم للنمط المطنب\n"
#: src/wayland/meta-wayland-tablet-pad.c:563
#, c-format
msgid "Mode Switch: Mode %d"
msgstr ""
#: src/x11/session.c:1815
#, fuzzy
#: ../src/x11/session.c:1815
msgid ""
"These windows do not support save current setup and will have to be "
"restarted manually next time you log in."
"These windows do not support &quot;save current setup&quot; and will have to "
"be restarted manually next time you log in."
msgstr ""
"هذه النوافذ لا تدعم &quot;احفظ الضبط الحالي&quot; يجب إعادة تشغيلها يدويا "
"عند الولوج المرة القادمة."
#: src/x11/window-props.c:559
#: ../src/x11/window-props.c:549
#, c-format
msgid "%s (on %s)"
msgstr "%s (على %s)"

137
po/es.po
View File

@@ -12,10 +12,10 @@
msgid ""
msgstr ""
"Project-Id-Version: mutter.master\n"
"Report-Msgid-Bugs-To: https://bugzilla.gnome.org/enter_bug.cgi?"
"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?"
"product=mutter&keywords=I18N+L10N&component=general\n"
"POT-Creation-Date: 2017-06-01 06:38+0000\n"
"PO-Revision-Date: 2017-06-19 13:47+0200\n"
"POT-Creation-Date: 2017-02-16 01:44+0000\n"
"PO-Revision-Date: 2017-02-17 11:38+0100\n"
"Last-Translator: Daniel Mustieles <daniel.mustieles@gmail.com>\n"
"Language-Team: es <gnome-es-list@gnome.org>\n"
"Language: es\n"
@@ -275,6 +275,11 @@ msgstr ""
"Modificador que usar para extender las operaciones de gestión sobre ventanas"
#: data/org.gnome.mutter.gschema.xml.in:8
#| msgid ""
#| "This key will initiate the \"overlay\", which is a combination window "
#| "overview and application launching system. The default is intended to be "
#| "the \"Windows key\" on PC hardware. It's expected that this binding "
#| "either the default or set to the empty string."
msgid ""
"This key will initiate the “overlay”, which is a combination window overview "
"and application launching system. The default is intended to be the “Windows "
@@ -323,6 +328,10 @@ msgid "Workspaces are managed dynamically"
msgstr "Las áreas de trabajo se gestionan dinámicamente"
#: data/org.gnome.mutter.gschema.xml.in:41
#| msgid ""
#| "Determines whether workspaces are managed dynamically or whether there's "
#| "a static number of workspaces (determined by the num-workspaces key in "
#| "org.gnome.desktop.wm.preferences)."
msgid ""
"Determines whether workspaces are managed dynamically or whether theres a "
"static number of workspaces (determined by the num-workspaces key in org."
@@ -361,6 +370,10 @@ msgid "Delay focus changes until the pointer stops moving"
msgstr "Retrasar el cambio de foco hasta detener el puntero"
#: data/org.gnome.mutter.gschema.xml.in:69
#| msgid ""
#| "If set to true, and the focus mode is either \"sloppy\" or \"mouse\" then "
#| "the focus will not be changed immediately when entering a window, but "
#| "only after the pointer stops moving."
msgid ""
"If set to true, and the focus mode is either “sloppy” or “mouse” then the "
"focus will not be changed immediately when entering a window, but only after "
@@ -375,6 +388,9 @@ msgid "Draggable border width"
msgstr "Anchura arrastrable del borde"
#: data/org.gnome.mutter.gschema.xml.in:80
#| msgid ""
#| "The amount of total draggable borders. If the theme's visible borders are "
#| "not enough, invisible borders will be added to meet this value."
msgid ""
"The amount of total draggable borders. If the themes visible borders are "
"not enough, invisible borders will be added to meet this value."
@@ -409,36 +425,11 @@ msgstr ""
"Cuando es cierto, las ventanas nuevas se colocarán siempre en el centro de "
"la pantalla activa del monitor."
#: data/org.gnome.mutter.gschema.xml.in:107
msgid "Enable experimental features"
msgstr "Activar las características experimentales"
#: data/org.gnome.mutter.gschema.xml.in:108
#, fuzzy
msgid ""
"To enable experimental features, add the feature keyword to the list. "
"Whether the feature requires restarting the compositor depends on the given "
"feature. Any experimental feature is not required to still be available, or "
"configurable. Dont expect adding anything in this setting to be future "
"proof. Currently possible keywords: • “monitor-config-manager” — use the new "
"monitor configuration system, aimed to replace the old one. This enables a "
"higher level configuration API to be used by configuration applications, as "
"well as the ability to configure per logical monitor scale. • “scale-monitor-"
"framebuffer” — makes mutter default to layout logical monitors in a logical "
"pixel coordinate space, while scaling monitor framebuffers instead of window "
"content, to manage HiDPI monitors. Does not require a restart. Also enabling "
"“monitor-config-manager” is required for this feature to be enabled."
msgstr ""
"Para activar las características experimentales, añada la palabra clave de "
"la característica a la lista. Depende de la característica que se deba "
"reiniciar o no el compositor. Cualquier característica experimental puede no "
"estar disponible o ser configurable. "
#: data/org.gnome.mutter.gschema.xml.in:151
#: data/org.gnome.mutter.gschema.xml.in:120
msgid "Select window from tab popup"
msgstr "Seleccionar ventana de la pestaña emergente"
#: data/org.gnome.mutter.gschema.xml.in:156
#: data/org.gnome.mutter.gschema.xml.in:125
msgid "Cancel tab popup"
msgstr "Cancelar pestaña emergente"
@@ -493,46 +484,50 @@ msgstr "Cambiar al VT 12"
#. TRANSLATORS: This string refers to a button that switches between
#. * different modes.
#.
#: src/backends/meta-input-settings.c:1866
#: src/backends/meta-input-settings.c:1759
#, c-format
#| msgid "Mode Switch: Mode %d"
msgid "Mode Switch (Group %d)"
msgstr "Cambiar modo (grupo %d)"
#. TRANSLATORS: This string refers to an action, cycles drawing tablets'
#. * mapping through the available outputs.
#.
#: src/backends/meta-input-settings.c:1888
#: src/backends/meta-input-settings.c:1781
msgid "Switch monitor"
msgstr "Cambiar monitor"
#: src/backends/meta-input-settings.c:1890
#: src/backends/meta-input-settings.c:1783
msgid "Show on-screen help"
msgstr "Mostrar la ayuda en pantalla"
#: src/backends/meta-monitor-manager.c:879
#: src/backends/meta-monitor-manager.c:675
msgid "Built-in display"
msgstr "Pantalla integrada"
#: src/backends/meta-monitor-manager.c:902
#: src/backends/meta-monitor-manager.c:698
msgid "Unknown"
msgstr "Desconocida"
#: src/backends/meta-monitor-manager.c:904
#: src/backends/meta-monitor-manager.c:700
msgid "Unknown Display"
msgstr "Pantalla desconocida"
#. TRANSLATORS: this is a monitor vendor name, followed by a
#. * size in inches, like 'Dell 15"'
#.
#: src/backends/meta-monitor-manager.c:912
#: src/backends/meta-monitor-manager.c:708
#, c-format
msgid "%s %s"
msgstr "%s %s"
#. This probably means that a non-WM compositor like xcompmgr is running;
#. * we have no way to get it to exit
#: src/compositor/compositor.c:476
#: src/compositor/compositor.c:471
#, c-format
#| msgid ""
#| "Another compositing manager is already running on screen %i on display "
#| "\"%s\"."
msgid ""
"Another compositing manager is already running on screen %i on display “%s”."
msgstr ""
@@ -543,8 +538,35 @@ msgstr ""
msgid "Bell event"
msgstr "Evento de campana"
#. Translators: %s is a window title
#: src/core/delete.c:127
#, c-format
msgid "“%s” is not responding."
msgstr "«%s» no está respondiendo."
#: src/core/delete.c:129
msgid "Application is not responding."
msgstr "La aplicación no está respondiendo."
#: src/core/delete.c:134
msgid ""
"You may choose to wait a short while for it to continue or force the "
"application to quit entirely."
msgstr ""
"Puede elegir esperar un rato para ver si continua o forzar la aplicación "
"para cerrarla completamente."
#: src/core/delete.c:141
msgid "_Force Quit"
msgstr "_Forzar la salida"
#: src/core/delete.c:141
msgid "_Wait"
msgstr "_Esperar"
#: src/core/display.c:608
#, c-format
#| msgid "Failed to open X Window System display '%s'\n"
msgid "Failed to open X Window System display “%s”\n"
msgstr "Ocurrió un error al abrir la pantalla de X Window System «%s»\n"
@@ -584,34 +606,14 @@ msgstr "Ejecutar como compositor anidado"
msgid "Run as a full display server, rather than nested"
msgstr "Ejecutar como servidor completo, en lugar de anidado"
#. Translators: %s is a window title
#: src/core/meta-close-dialog-default.c:147
#, c-format
msgid "“%s” is not responding."
msgstr "«%s» no está respondiendo."
#: src/core/meta-close-dialog-default.c:149
msgid "Application is not responding."
msgstr "La aplicación no está respondiendo."
#: src/core/meta-close-dialog-default.c:154
msgid ""
"You may choose to wait a short while for it to continue or force the "
"application to quit entirely."
msgstr ""
"Puede elegir esperar un rato para ver si continua o forzar la aplicación "
"para cerrarla completamente."
#: src/core/meta-close-dialog-default.c:161
msgid "_Force Quit"
msgstr "_Forzar la salida"
#: src/core/meta-close-dialog-default.c:161
msgid "_Wait"
msgstr "_Esperar"
#: src/core/mutter.c:39
#, c-format
#| msgid ""
#| "mutter %s\n"
#| "Copyright (C) 2001-%d Havoc Pennington, Red Hat, Inc., and others\n"
#| "This is free software; see the source for copying conditions.\n"
#| "There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A "
#| "PARTICULAR PURPOSE.\n"
msgid ""
"mutter %s\n"
"Copyright © 2001-%d Havoc Pennington, Red Hat, Inc., and others\n"
@@ -641,6 +643,9 @@ msgstr "Área de trabajo %d"
#: src/core/screen.c:580
#, c-format
#| msgid ""
#| "Display \"%s\" already has a window manager; try using the --replace "
#| "option to replace the current window manager."
msgid ""
"Display “%s” already has a window manager; try using the --replace option to "
"replace the current window manager."
@@ -650,6 +655,7 @@ msgstr ""
#: src/core/screen.c:665
#, c-format
#| msgid "Screen %d on display '%s' is invalid\n"
msgid "Screen %d on display “%s” is invalid\n"
msgstr "La ventana %d en la pantalla «%s» no es válida\n"
@@ -663,6 +669,9 @@ msgid "Mode Switch: Mode %d"
msgstr "Cambiar modo: modo %d"
#: src/x11/session.c:1815
#| msgid ""
#| "These windows do not support &quot;save current setup&quot; and will have "
#| "to be restarted manually next time you log in."
msgid ""
"These windows do not support “save current setup” and will have to be "
"restarted manually next time you log in."

102
po/fur.po
View File

@@ -8,8 +8,8 @@ msgstr ""
"Project-Id-Version: mutter master\n"
"Report-Msgid-Bugs-To: https://bugzilla.gnome.org/enter_bug.cgi?"
"product=mutter&keywords=I18N+L10N&component=general\n"
"POT-Creation-Date: 2017-05-26 14:16+0000\n"
"PO-Revision-Date: 2017-05-27 22:55+0200\n"
"POT-Creation-Date: 2017-04-21 21:33+0000\n"
"PO-Revision-Date: 2017-04-30 15:41+0200\n"
"Last-Translator: Fabio Tomat <f.t.public@gmail.com>\n"
"Language-Team: Friulian <fur@li.org>\n"
"Language: fur\n"
@@ -405,14 +405,10 @@ msgid ""
"Whether the feature requires restarting the compositor depends on the given "
"feature. Any experimental feature is not required to still be available, or "
"configurable. Dont expect adding anything in this setting to be future "
"proof. Currently possible keywords: • “monitor-config-manager” — use the new "
"monitor configuration system, aimed to replace the old one. This enables a "
"higher level configuration API to be used by configuration applications, as "
"well as the ability to configure per logical monitor scale. • “scale-monitor-"
"framebuffer” — makes mutter default to layout logical monitors in a logical "
"pixel coordinate space, while scaling monitor framebuffers instead of window "
"content, to manage HiDPI monitors. Does not require a restart. Also enabling "
"“monitor-config-manager” is required for this feature to be enabled."
"proof. Currently possible keywords: • “scale-monitor-framebuffer” — makes "
"mutter default to layout logical monitors in a logical pixel coordinate "
"space, while scaling monitor framebuffers instead of window content, to "
"manage HiDPI monitors. Does not require a restart."
msgstr ""
"Par abilitâ lis funzionalitâts sperimentâls, zonte la peraule clâf de "
"funzionalitât ae liste. Il fat che la funzionalitât e vedi bisugne di tornâ "
@@ -420,22 +416,16 @@ msgstr ""
"funzionalitât sperimentâl no je necessarie che e sedi disponibile o "
"configurabile. No sta spietâti di zontâ alc in cheste impostazion e pensâ "
"che e duredi tal timp. Atualmentri lis peraulis clâf pussibilis a son: • "
"“monitor-config-manager” — al dopre il gnûf sisteme di configurazion dal "
"visôr, fat par sostituî chel vecjo. Chest al abilite une API di nivel "
"superiôr che e pues jessi doprade di aplicazions di configurazion, cussì "
"come la capacitât di configurâ par scjale di monitor logjic. • “scale-"
"monitor-framebuffer” — al rint come predefinît par mutter la disposizion dai "
"visôrs logjics intun spazi logjic di coordenadis dai pixel, intant i "
"framebuffer dai visôrs par scjalâ, invezit dal contignût dal barcon, a "
"gjestissin i visôrs HiDPI. Nol covente tornâ a inviâ. In plui al è necessari "
"abilitâ “monitor-config-manager” par fâ in mût che cheste funzionalitât e "
"sedi abilitade."
"“scale-monitor-framebuffer” — al rint come predefinît par mutter la "
"disposizion dai visôrs logjics intun spazi logjic di coordenadis dai pixel, "
"intant i framebuffer dai visôrs par scjalâ, invezit dal contignût dal "
"barcon, a gjestissin i visôrs HiDPI. Nol covente tornâ a inviâ."
#: data/org.gnome.mutter.gschema.xml.in:151
#: data/org.gnome.mutter.gschema.xml.in:141
msgid "Select window from tab popup"
msgstr "Selezione barcon dal tab popup"
#: data/org.gnome.mutter.gschema.xml.in:156
#: data/org.gnome.mutter.gschema.xml.in:146
msgid "Cancel tab popup"
msgstr "Anule tab popup"
@@ -490,7 +480,7 @@ msgstr "Passe al VT 12"
#. TRANSLATORS: This string refers to a button that switches between
#. * different modes.
#.
#: src/backends/meta-input-settings.c:1866
#: src/backends/meta-input-settings.c:1848
#, c-format
msgid "Mode Switch (Group %d)"
msgstr "Cambie mût (Grup %d)"
@@ -498,37 +488,37 @@ msgstr "Cambie mût (Grup %d)"
#. TRANSLATORS: This string refers to an action, cycles drawing tablets'
#. * mapping through the available outputs.
#.
#: src/backends/meta-input-settings.c:1888
#: src/backends/meta-input-settings.c:1870
msgid "Switch monitor"
msgstr "Cambie visôr"
#: src/backends/meta-input-settings.c:1890
#: src/backends/meta-input-settings.c:1872
msgid "Show on-screen help"
msgstr "Mostre jutori a schermi"
#: src/backends/meta-monitor-manager.c:876
#: src/backends/meta-monitor-manager.c:783
msgid "Built-in display"
msgstr "Display integrât"
#: src/backends/meta-monitor-manager.c:899
#: src/backends/meta-monitor-manager.c:806
msgid "Unknown"
msgstr "No cognossût"
#: src/backends/meta-monitor-manager.c:901
#: src/backends/meta-monitor-manager.c:808
msgid "Unknown Display"
msgstr "Display no cognossût"
#. TRANSLATORS: this is a monitor vendor name, followed by a
#. * size in inches, like 'Dell 15"'
#.
#: src/backends/meta-monitor-manager.c:909
#: src/backends/meta-monitor-manager.c:816
#, c-format
msgid "%s %s"
msgstr "%s %s"
#. This probably means that a non-WM compositor like xcompmgr is running;
#. * we have no way to get it to exit
#: src/compositor/compositor.c:476
#: src/compositor/compositor.c:474
#, c-format
msgid ""
"Another compositing manager is already running on screen %i on display “%s”."
@@ -540,6 +530,32 @@ msgstr ""
msgid "Bell event"
msgstr "Event cjampane"
#. Translators: %s is a window title
#: src/core/delete.c:127
#, c-format
msgid "“%s” is not responding."
msgstr "“%s” nol rispuint."
#: src/core/delete.c:129
msgid "Application is not responding."
msgstr "La aplicazion no rispuint."
#: src/core/delete.c:134
msgid ""
"You may choose to wait a short while for it to continue or force the "
"application to quit entirely."
msgstr ""
"Al è pussibil sielzi di spietâ un pôc lassant che la aplicazion e continui o "
"sfuarçâ la aplicazion par sierâle dal dut."
#: src/core/delete.c:141
msgid "_Force Quit"
msgstr "Sfuarce _Jessude"
#: src/core/delete.c:141
msgid "_Wait"
msgstr "_Spiete"
#: src/core/display.c:608
#, c-format
msgid "Failed to open X Window System display “%s”\n"
@@ -581,32 +597,6 @@ msgstr "Eseguìs come compositor nidiât"
msgid "Run as a full display server, rather than nested"
msgstr "Eseguìs come servidôr display complet, invezit che nidiât"
#. Translators: %s is a window title
#: src/core/meta-close-dialog-default.c:147
#, c-format
msgid "“%s” is not responding."
msgstr "“%s” nol rispuint."
#: src/core/meta-close-dialog-default.c:149
msgid "Application is not responding."
msgstr "La aplicazion no rispuint."
#: src/core/meta-close-dialog-default.c:154
msgid ""
"You may choose to wait a short while for it to continue or force the "
"application to quit entirely."
msgstr ""
"Al è pussibil sielzi di spietâ un pôc lassant che la aplicazion e continui o "
"sfuarçâ la aplicazion par sierâle dal dut."
#: src/core/meta-close-dialog-default.c:161
msgid "_Force Quit"
msgstr "Sfuarce _Jessude"
#: src/core/meta-close-dialog-default.c:161
msgid "_Wait"
msgstr "_Spiete"
#: src/core/mutter.c:39
#, c-format
msgid ""

105
po/id.po
View File

@@ -11,15 +11,15 @@ msgstr ""
"Project-Id-Version: mutter master\n"
"Report-Msgid-Bugs-To: https://bugzilla.gnome.org/enter_bug.cgi?"
"product=mutter&keywords=I18N+L10N&component=general\n"
"POT-Creation-Date: 2017-05-31 14:13+0000\n"
"PO-Revision-Date: 2017-06-07 15:00+0700\n"
"Last-Translator: Andika Triwidada <andika@gmail.com>\n"
"POT-Creation-Date: 2017-04-21 21:33+0000\n"
"PO-Revision-Date: 2017-04-23 14:39+0700\n"
"Last-Translator: Kukuh Syafaat <syafaatkukuh@gmail.com>\n"
"Language-Team: Indonesian <gnome-l10n-id@googlegroups.com>\n"
"Language: id\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.6.10\n"
"X-Generator: Poedit 1.8.11\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#: data/50-mutter-navigation.xml:6
@@ -408,35 +408,26 @@ msgid ""
"Whether the feature requires restarting the compositor depends on the given "
"feature. Any experimental feature is not required to still be available, or "
"configurable. Dont expect adding anything in this setting to be future "
"proof. Currently possible keywords: • “monitor-config-manager” — use the new "
"monitor configuration system, aimed to replace the old one. This enables a "
"higher level configuration API to be used by configuration applications, as "
"well as the ability to configure per logical monitor scale. • “scale-monitor-"
"framebuffer” — makes mutter default to layout logical monitors in a logical "
"pixel coordinate space, while scaling monitor framebuffers instead of window "
"content, to manage HiDPI monitors. Does not require a restart. Also enabling "
"“monitor-config-manager” is required for this feature to be enabled."
"proof. Currently possible keywords: • “scale-monitor-framebuffer” — makes "
"mutter default to layout logical monitors in a logical pixel coordinate "
"space, while scaling monitor framebuffers instead of window content, to "
"manage HiDPI monitors. Does not require a restart."
msgstr ""
"Untuk mengaktifkan fitur eksperimental, tambahkan kata kunci fitur ke dalam "
"daftar. Apakah fitur memerlukan nyala ulang kompositor tergantung pada fitur "
"yang diberikan. Setiap fitur eksperimental tidak diharuskan tetap tersedia, "
"atau dapat dikonfigurasi. Jangan berharap menambahkan apapun dalam "
"pengaturan ini kebal perubahan di masa depan. Saat ini kata kunci yang "
"mungkin: • \"monitor-config-manager\" — gunakan sistem konfigurasi monitor "
"baru, yang ditujukan untuk mengganti yang lama. Hal ini memungkinkan tingkat "
"konfigurasi API yang lebih tinggi untuk digunakan oleh aplikasi konfigurasi, "
"serta kemampuan untuk mengkonfigurasi per skala monitor logikal. • “scale-"
"monitor-framebuffer” — membuat bawaan mutter untuk tata letak monitor "
"logikal dalam ruang koordinat pixel logikal, sambil menskalakan framebuffer "
"monitor alih-alih konten jendela, untuk mengelola monitor HiDPI. Tidak perlu "
"mulai ulang. Juga mengaktifkan “monitor-config-manager” diperlukan agar "
"fitur ini diaktifkan."
"pengaturan ini sebagai bukti di masa depan. Saat ini kata kunci yang "
"mungkin: • \"scale-monitor-framebuffer\" — membuat mutter bawaan ke tata "
"letak monitor logikal dalam ruang koordinat pixel logikal, sementara skala "
"monitor framebuffer bukan konten jendela, untuk mengatur monitor HiDPI. "
"Tidak perlu nyala ulang."
#: data/org.gnome.mutter.gschema.xml.in:151
#: data/org.gnome.mutter.gschema.xml.in:141
msgid "Select window from tab popup"
msgstr "Pilih jendela dari popup tab"
#: data/org.gnome.mutter.gschema.xml.in:156
#: data/org.gnome.mutter.gschema.xml.in:146
msgid "Cancel tab popup"
msgstr "Batalkan popup tab"
@@ -491,7 +482,7 @@ msgstr "Bertukar ke VT 12"
#. TRANSLATORS: This string refers to a button that switches between
#. * different modes.
#.
#: src/backends/meta-input-settings.c:1866
#: src/backends/meta-input-settings.c:1848
#, c-format
msgid "Mode Switch (Group %d)"
msgstr "Tukar Mode: (Grup %d)"
@@ -499,37 +490,37 @@ msgstr "Tukar Mode: (Grup %d)"
#. TRANSLATORS: This string refers to an action, cycles drawing tablets'
#. * mapping through the available outputs.
#.
#: src/backends/meta-input-settings.c:1888
#: src/backends/meta-input-settings.c:1870
msgid "Switch monitor"
msgstr "Berpindah monitor"
#: src/backends/meta-input-settings.c:1890
#: src/backends/meta-input-settings.c:1872
msgid "Show on-screen help"
msgstr "Tampilkan bantuan pada layar"
#: src/backends/meta-monitor-manager.c:879
#: src/backends/meta-monitor-manager.c:783
msgid "Built-in display"
msgstr "Tampilan bawaan"
#: src/backends/meta-monitor-manager.c:902
#: src/backends/meta-monitor-manager.c:806
msgid "Unknown"
msgstr "Tak Dikenal"
#: src/backends/meta-monitor-manager.c:904
#: src/backends/meta-monitor-manager.c:808
msgid "Unknown Display"
msgstr "Tampilan Tak Dikenal"
#. TRANSLATORS: this is a monitor vendor name, followed by a
#. * size in inches, like 'Dell 15"'
#.
#: src/backends/meta-monitor-manager.c:912
#: src/backends/meta-monitor-manager.c:816
#, c-format
msgid "%s %s"
msgstr "%s %s"
#. This probably means that a non-WM compositor like xcompmgr is running;
#. * we have no way to get it to exit
#: src/compositor/compositor.c:476
#: src/compositor/compositor.c:474
#, c-format
msgid ""
"Another compositing manager is already running on screen %i on display “%s”."
@@ -540,6 +531,31 @@ msgstr ""
msgid "Bell event"
msgstr "Bel peristiwa"
#. Translators: %s is a window title
#: src/core/delete.c:127
#, c-format
msgid "“%s” is not responding."
msgstr "\"%s\" tak merespon."
#: src/core/delete.c:129
msgid "Application is not responding."
msgstr "Aplikasi tak merespon."
#: src/core/delete.c:134
msgid ""
"You may choose to wait a short while for it to continue or force the "
"application to quit entirely."
msgstr ""
"Anda bisa memilih untuk menunggu sebentar atau memaksa aplikasi keluar."
#: src/core/delete.c:141
msgid "_Force Quit"
msgstr "_Matikan Paksa"
#: src/core/delete.c:141
msgid "_Wait"
msgstr "_Tunggu"
#: src/core/display.c:608
#, c-format
msgid "Failed to open X Window System display “%s”\n"
@@ -581,31 +597,6 @@ msgstr "Jalankan sebagai kompositor bersarang"
msgid "Run as a full display server, rather than nested"
msgstr "Jalankan sebagai server tampilan penuh, ketimbang tampilan bersarang"
#. Translators: %s is a window title
#: src/core/meta-close-dialog-default.c:147
#, c-format
msgid "“%s” is not responding."
msgstr "\"%s\" tak merespon."
#: src/core/meta-close-dialog-default.c:149
msgid "Application is not responding."
msgstr "Aplikasi tak merespon."
#: src/core/meta-close-dialog-default.c:154
msgid ""
"You may choose to wait a short while for it to continue or force the "
"application to quit entirely."
msgstr ""
"Anda bisa memilih untuk menunggu sebentar atau memaksa aplikasi keluar."
#: src/core/meta-close-dialog-default.c:161
msgid "_Force Quit"
msgstr "_Matikan Paksa"
#: src/core/meta-close-dialog-default.c:161
msgid "_Wait"
msgstr "_Tunggu"
#: src/core/mutter.c:39
#, c-format
msgid ""

View File

@@ -82,7 +82,6 @@ wayland_protocols = \
libmutter_@LIBMUTTER_API_VERSION@_la_SOURCES = \
backends/meta-backend.c \
meta/meta-backend.h \
meta/meta-settings.h \
backends/meta-backend-private.h \
backends/meta-barrier.c \
backends/meta-barrier-private.h \
@@ -118,12 +117,8 @@ libmutter_@LIBMUTTER_API_VERSION@_la_SOURCES = \
backends/meta-monitor-manager-private.h \
backends/meta-monitor-manager-dummy.c \
backends/meta-monitor-manager-dummy.h \
backends/meta-orientation-manager.c \
backends/meta-orientation-manager.h \
backends/meta-pointer-constraint.c \
backends/meta-pointer-constraint.h \
backends/meta-settings.c \
backends/meta-settings-private.h \
backends/meta-stage.h \
backends/meta-stage.c \
backends/meta-renderer.c \
@@ -450,7 +445,6 @@ libmutterinclude_headers = \
meta/meta-idle-monitor.h \
meta/meta-plugin.h \
meta/meta-monitor-manager.h \
meta/meta-settings.h \
meta/meta-shaped-texture.h \
meta/meta-shadow-factory.h \
meta/meta-window-actor.h \
@@ -580,7 +574,7 @@ stamp-meta-enum-types.h: $(libmutterinclude_headers) meta-enum-types.h.in
$(AM_V_GEN) ( cd $(srcdir) && \
$(GLIB_MKENUMS) \
--template meta-enum-types.h.in \
$(libmutterinclude_headers) ) > xgen-teth && \
$(libmutterinclude_base_headers) ) >> xgen-teth && \
(cmp -s xgen-teth meta/meta-enum-types.h || cp xgen-teth meta/meta-enum-types.h) && \
rm -f xgen-teth && \
echo timestamp > $(@F)
@@ -589,7 +583,7 @@ meta-enum-types.c: stamp-meta-enum-types.h meta-enum-types.c.in
$(AM_V_GEN) ( cd $(srcdir) && \
$(GLIB_MKENUMS) \
--template meta-enum-types.c.in \
$(libmutterinclude_headers) ) > xgen-tetc && \
$(libmutterinclude_base_headers) ) >> xgen-tetc && \
cp xgen-tetc meta-enum-types.c && \
rm -f xgen-tetc

View File

@@ -34,12 +34,10 @@
#include <meta/meta-idle-monitor.h>
#include "meta-cursor-renderer.h"
#include "meta-monitor-manager-private.h"
#include "meta-orientation-manager.h"
#include "meta-input-settings-private.h"
#include "backends/meta-egl.h"
#include "backends/meta-pointer-constraint.h"
#include "backends/meta-renderer.h"
#include "backends/meta-settings-private.h"
#include "core/util-private.h"
#define DEFAULT_XKB_RULES_FILE "evdev"
@@ -61,7 +59,6 @@ struct _MetaBackendClass
MetaMonitorManager * (* create_monitor_manager) (MetaBackend *backend);
MetaCursorRenderer * (* create_cursor_renderer) (MetaBackend *backend);
MetaRenderer * (* create_renderer) (MetaBackend *backend);
MetaInputSettings * (* create_input_settings) (MetaBackend *backend);
gboolean (* grab_device) (MetaBackend *backend,
int device_id,
@@ -100,9 +97,16 @@ struct _MetaBackendClass
};
typedef enum _MetaExperimentalFeature
{
META_EXPERIMENTAL_FEATURE_NONE = 0,
META_EXPERIMENTAL_FEATURE_SCALE_MONITOR_FRAMEBUFFER = (1 << 0),
META_EXPERIMENTAL_FEATURE_MONITOR_CONFIG_MANAGER = (1 << 1)
} MetaExperimentalFeature;
void meta_init_backend (GType backend_gtype);
void meta_backend_x11_display_opened (MetaBackend *backend);
void meta_backend_display_opened (MetaBackend *backend);
ClutterBackend * meta_backend_get_clutter_backend (MetaBackend *backend);
@@ -113,12 +117,10 @@ void meta_backend_foreach_device_monitor (MetaBackend *backend,
gpointer user_data);
MetaMonitorManager * meta_backend_get_monitor_manager (MetaBackend *backend);
MetaOrientationManager * meta_backend_get_orientation_manager (MetaBackend *backend);
MetaCursorTracker * meta_backend_get_cursor_tracker (MetaBackend *backend);
MetaCursorRenderer * meta_backend_get_cursor_renderer (MetaBackend *backend);
MetaRenderer * meta_backend_get_renderer (MetaBackend *backend);
MetaEgl * meta_backend_get_egl (MetaBackend *backend);
MetaSettings * meta_backend_get_settings (MetaBackend *backend);
gboolean meta_backend_grab_device (MetaBackend *backend,
int device_id,
@@ -153,6 +155,16 @@ ClutterBackend * meta_backend_get_clutter_backend (MetaBackend *backend);
void meta_backend_monitors_changed (MetaBackend *backend);
gboolean meta_backend_is_experimental_feature_enabled (MetaBackend *backend,
MetaExperimentalFeature feature);
MetaExperimentalFeature meta_backend_get_experimental_features (MetaBackend *backend);
void meta_backend_override_experimental_features (MetaBackend *backend);
void meta_backend_enable_experimental_feature (MetaBackend *backend,
MetaExperimentalFeature feature);
gboolean meta_is_stage_views_enabled (void);
gboolean meta_is_stage_views_scaled (void);

View File

@@ -43,16 +43,15 @@
#include "backends/meta-idle-monitor-private.h"
#include "backends/meta-logical-monitor.h"
#include "backends/meta-monitor-manager-dummy.h"
#include "backends/meta-settings-private.h"
#define META_IDLE_MONITOR_CORE_DEVICE 0
#include "ui/theme-private.h"
enum
{
KEYMAP_CHANGED,
KEYMAP_LAYOUT_GROUP_CHANGED,
LAST_DEVICE_CHANGED,
X11_DISPLAY_OPENED,
EXPERIMENTAL_FEATURES_CHANGED,
UI_SCALING_FACTOR_CHANGED,
N_SIGNALS
};
@@ -79,13 +78,15 @@ meta_get_backend (void)
struct _MetaBackendPrivate
{
MetaMonitorManager *monitor_manager;
MetaOrientationManager *orientation_manager;
MetaCursorTracker *cursor_tracker;
MetaCursorRenderer *cursor_renderer;
MetaInputSettings *input_settings;
MetaRenderer *renderer;
MetaEgl *egl;
MetaSettings *settings;
GSettings *mutter_settings;
MetaExperimentalFeature experimental_features;
gboolean experimental_features_overridden;
ClutterBackend *clutter_backend;
ClutterActor *stage;
@@ -98,6 +99,8 @@ struct _MetaBackendPrivate
MetaPointerConstraint *client_pointer_constraint;
MetaDnd *dnd;
int ui_scaling_factor;
};
typedef struct _MetaBackendPrivate MetaBackendPrivate;
@@ -116,7 +119,6 @@ meta_backend_finalize (GObject *object)
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
g_clear_object (&priv->monitor_manager);
g_clear_object (&priv->orientation_manager);
g_clear_object (&priv->input_settings);
if (priv->device_update_idle_id)
@@ -124,8 +126,6 @@ meta_backend_finalize (GObject *object)
g_hash_table_destroy (priv->device_monitors);
g_clear_object (&priv->settings);
G_OBJECT_CLASS (meta_backend_parent_class)->finalize (object);
}
@@ -155,10 +155,28 @@ center_pointer (MetaBackend *backend)
primary->rect.y + primary->rect.height / 2);
}
static gboolean
meta_backend_update_ui_scaling_factor (MetaBackend *backend)
{
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
int ui_scaling_factor;
ui_scaling_factor = meta_backend_get_ui_scaling_factor (backend);
if (ui_scaling_factor != priv->ui_scaling_factor)
{
priv->ui_scaling_factor = ui_scaling_factor;
return TRUE;
}
else
{
return FALSE;
}
}
void
meta_backend_monitors_changed (MetaBackend *backend)
{
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
MetaMonitorManager *monitor_manager =
meta_backend_get_monitor_manager (backend);
ClutterDeviceManager *manager = clutter_device_manager_get_default ();
@@ -176,7 +194,8 @@ meta_backend_monitors_changed (MetaBackend *backend)
center_pointer (backend);
}
meta_settings_update_ui_scaling_factor (priv->settings);
if (meta_backend_update_ui_scaling_factor (backend))
meta_backend_notify_ui_scaling_factor_changed (backend);
}
void
@@ -226,16 +245,6 @@ destroy_device_monitor (MetaBackend *backend,
g_hash_table_remove (priv->device_monitors, &device_id);
}
static void
meta_backend_monitor_device (MetaBackend *backend,
ClutterInputDevice *device)
{
int device_id;
device_id = clutter_input_device_get_device_id (device);
create_device_monitor (backend, device_id);
}
static void
on_device_added (ClutterDeviceManager *device_manager,
ClutterInputDevice *device,
@@ -343,56 +352,10 @@ create_monitor_manager (MetaBackend *backend)
return META_BACKEND_GET_CLASS (backend)->create_monitor_manager (backend);
}
static void
create_device_monitors (MetaBackend *backend,
ClutterDeviceManager *device_manager)
{
const GSList *devices;
const GSList *l;
create_device_monitor (backend, META_IDLE_MONITOR_CORE_DEVICE);
devices = clutter_device_manager_peek_devices (device_manager);
for (l = devices; l; l = l->next)
{
ClutterInputDevice *device = l->data;
meta_backend_monitor_device (backend, device);
}
}
static void
set_initial_pointer_visibility (MetaBackend *backend,
ClutterDeviceManager *device_manager)
{
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
const GSList *devices;
const GSList *l;
gboolean has_touchscreen = FALSE;
devices = clutter_device_manager_peek_devices (device_manager);
for (l = devices; l; l = l->next)
{
ClutterInputDevice *device = l->data;
has_touchscreen |= device_is_slave_touchscreen (device);
}
meta_cursor_tracker_set_pointer_visible (priv->cursor_tracker,
!has_touchscreen);
}
static MetaInputSettings *
meta_backend_create_input_settings (MetaBackend *backend)
{
return META_BACKEND_GET_CLASS (backend)->create_input_settings (backend);
}
static void
meta_backend_real_post_init (MetaBackend *backend)
{
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
ClutterDeviceManager *device_manager = clutter_device_manager_get_default ();
priv->stage = meta_stage_new ();
clutter_actor_realize (priv->stage);
@@ -402,22 +365,45 @@ meta_backend_real_post_init (MetaBackend *backend)
meta_backend_sync_screen_size (backend);
meta_backend_update_ui_scaling_factor (backend);
priv->cursor_renderer = META_BACKEND_GET_CLASS (backend)->create_cursor_renderer (backend);
priv->device_monitors =
g_hash_table_new_full (g_int_hash, g_int_equal,
NULL, (GDestroyNotify) g_object_unref);
create_device_monitors (backend, device_manager);
{
MetaCursorTracker *cursor_tracker;
ClutterDeviceManager *manager;
gboolean has_touchscreen = FALSE;
GSList *devices, *l;
g_signal_connect_object (device_manager, "device-added",
G_CALLBACK (on_device_added), backend, 0);
g_signal_connect_object (device_manager, "device-removed",
G_CALLBACK (on_device_removed), backend, 0);
/* Create the core device monitor. */
create_device_monitor (backend, 0);
set_initial_pointer_visibility (backend, device_manager);
manager = clutter_device_manager_get_default ();
g_signal_connect_object (manager, "device-added",
G_CALLBACK (on_device_added), backend, 0);
g_signal_connect_object (manager, "device-removed",
G_CALLBACK (on_device_removed), backend, 0);
priv->input_settings = meta_backend_create_input_settings (backend);
devices = clutter_device_manager_list_devices (manager);
for (l = devices; l != NULL; l = l->next)
{
ClutterInputDevice *device = l->data;
on_device_added (manager, device, backend);
has_touchscreen |= device_is_slave_touchscreen (device);
}
cursor_tracker = priv->cursor_tracker;
meta_cursor_tracker_set_pointer_visible (cursor_tracker, !has_touchscreen);
g_slist_free (devices);
}
priv->input_settings = meta_input_settings_create ();
center_pointer (backend);
}
@@ -463,6 +449,105 @@ meta_backend_real_get_relative_motion_deltas (MetaBackend *backend,
return FALSE;
}
static gboolean
experimental_features_handler (GVariant *features_variant,
gpointer *result,
gpointer data)
{
MetaBackend *backend = data;
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
GVariantIter features_iter;
char *feature;
MetaExperimentalFeature features = META_EXPERIMENTAL_FEATURE_NONE;
if (priv->experimental_features_overridden)
{
*result = GINT_TO_POINTER (FALSE);
return TRUE;
}
g_variant_iter_init (&features_iter, features_variant);
while (g_variant_iter_loop (&features_iter, "s", &feature))
{
/* So far no experimental features defined. */
if (g_str_equal (feature, "scale-monitor-framebuffer"))
features |= META_EXPERIMENTAL_FEATURE_SCALE_MONITOR_FRAMEBUFFER;
else if (g_str_equal (feature, "monitor-config-manager"))
features |= META_EXPERIMENTAL_FEATURE_MONITOR_CONFIG_MANAGER;
else
g_info ("Unknown experimental feature '%s'\n", feature);
}
if (features != priv->experimental_features)
{
priv->experimental_features = features;
*result = GINT_TO_POINTER (TRUE);
}
else
{
*result = GINT_TO_POINTER (FALSE);
}
return TRUE;
}
static gboolean
update_experimental_features (MetaBackend *backend)
{
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
return GPOINTER_TO_INT (g_settings_get_mapped (priv->mutter_settings,
"experimental-features",
experimental_features_handler,
backend));
}
static void
mutter_settings_changed (GSettings *settings,
gchar *key,
MetaBackend *backend)
{
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
MetaExperimentalFeature old_experimental_features;
gboolean changed;
if (!g_str_equal (key, "experimental-features"))
return;
old_experimental_features = priv->experimental_features;
changed = update_experimental_features (backend);
if (changed)
g_signal_emit (backend, signals[EXPERIMENTAL_FEATURES_CHANGED], 0,
(unsigned int) old_experimental_features);
}
gboolean
meta_backend_is_experimental_feature_enabled (MetaBackend *backend,
MetaExperimentalFeature feature)
{
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
return !!(priv->experimental_features & feature);
}
void
meta_backend_override_experimental_features (MetaBackend *backend)
{
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
priv->experimental_features = META_EXPERIMENTAL_FEATURE_NONE;
priv->experimental_features_overridden = TRUE;
}
void
meta_backend_enable_experimental_feature (MetaBackend *backend,
MetaExperimentalFeature feature)
{
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
priv->experimental_features |= feature;
}
static void
meta_backend_class_init (MetaBackendClass *klass)
{
@@ -499,8 +584,15 @@ meta_backend_class_init (MetaBackendClass *klass)
0,
NULL, NULL, NULL,
G_TYPE_NONE, 1, G_TYPE_INT);
signals[X11_DISPLAY_OPENED] =
g_signal_new ("x11-display-opened",
signals[EXPERIMENTAL_FEATURES_CHANGED] =
g_signal_new ("experimental-features-changed",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
G_TYPE_NONE, 1, G_TYPE_UINT);
signals[UI_SCALING_FACTOR_CHANGED] =
g_signal_new ("ui-scaling-factor-changed",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
0,
@@ -519,7 +611,11 @@ meta_backend_initable_init (GInitable *initable,
MetaBackend *backend = META_BACKEND (initable);
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
priv->settings = meta_settings_new (backend);
priv->mutter_settings = g_settings_new ("org.gnome.mutter");
g_signal_connect (priv->mutter_settings, "changed",
G_CALLBACK (mutter_settings_changed),
backend);
update_experimental_features (backend);
priv->egl = g_object_new (META_TYPE_EGL, NULL);
@@ -536,8 +632,6 @@ meta_backend_initable_init (GInitable *initable,
priv->dnd = g_object_new (META_TYPE_DND, NULL);
priv->orientation_manager = g_object_new (META_TYPE_ORIENTATION_MANAGER, NULL);
return TRUE;
}
@@ -556,11 +650,7 @@ meta_backend_init (MetaBackend *backend)
static void
meta_backend_post_init (MetaBackend *backend)
{
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
META_BACKEND_GET_CLASS (backend)->post_init (backend);
meta_settings_post_init (priv->settings);
}
/**
@@ -586,17 +676,6 @@ meta_backend_get_monitor_manager (MetaBackend *backend)
return priv->monitor_manager;
}
/**
* meta_backend_get_orientation_manager: (skip)
*/
MetaOrientationManager *
meta_backend_get_orientation_manager (MetaBackend *backend)
{
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
return priv->orientation_manager;
}
MetaCursorTracker *
meta_backend_get_cursor_tracker (MetaBackend *backend)
{
@@ -619,8 +698,7 @@ meta_backend_get_cursor_renderer (MetaBackend *backend)
/**
* meta_backend_get_renderer: (skip)
*/
MetaRenderer *
meta_backend_get_renderer (MetaBackend *backend)
MetaRenderer * meta_backend_get_renderer (MetaBackend *backend)
{
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
@@ -630,25 +708,13 @@ meta_backend_get_renderer (MetaBackend *backend)
/**
* meta_backend_get_egl: (skip)
*/
MetaEgl *
meta_backend_get_egl (MetaBackend *backend)
MetaEgl * meta_backend_get_egl (MetaBackend *backend)
{
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
return priv->egl;
}
/**
* meta_backend_get_settings: (skip)
*/
MetaSettings *
meta_backend_get_settings (MetaBackend *backend)
{
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
return priv->settings;
}
/**
* meta_backend_grab_device: (skip)
*/
@@ -944,10 +1010,27 @@ meta_clutter_init (void)
meta_backend_post_init (_backend);
}
void
meta_backend_x11_display_opened (MetaBackend *backend)
static void
xft_dpi_changed (GtkSettings *settings,
GParamSpec *pspec,
MetaBackend *backend)
{
g_signal_emit (backend, signals[X11_DISPLAY_OPENED], 0);
meta_backend_update_ui_scaling_factor (backend);
meta_backend_notify_ui_scaling_factor_changed (backend);
}
void
meta_backend_display_opened (MetaBackend *backend)
{
/*
* gdk-window-scaling-factor is not exported to gtk-settings
* because it is handled inside gdk, so we use gtk-xft-dpi instead
* which also changes when the scale factor changes.
*
* TODO: Don't rely on GtkSettings for this
*/
g_signal_connect (gtk_settings_get_default (), "notify::gtk-xft-dpi",
G_CALLBACK (xft_dpi_changed), backend);
}
gboolean
@@ -1012,3 +1095,46 @@ meta_backend_notify_keymap_layout_group_changed (MetaBackend *backend,
g_signal_emit (backend, signals[KEYMAP_LAYOUT_GROUP_CHANGED], 0,
locked_group);
}
static int
calculate_ui_scaling_factor (MetaBackend *backend)
{
MetaMonitorManager *monitor_manager =
meta_backend_get_monitor_manager (backend);
GList *logical_monitors;
GList *l;
int max_scale = 1;
logical_monitors =
meta_monitor_manager_get_logical_monitors (monitor_manager);
for (l = logical_monitors; l; l = l->next)
{
MetaLogicalMonitor *logical_monitor = l->data;
max_scale = MAX (logical_monitor->scale, max_scale);
}
return max_scale;
}
int
meta_backend_get_ui_scaling_factor (MetaBackend *backend)
{
if (meta_is_stage_views_scaled ())
{
return 1;
}
else
{
if (meta_is_monitor_config_manager_enabled ())
return calculate_ui_scaling_factor (backend);
else
return meta_theme_get_window_scaling_factor ();
}
}
void
meta_backend_notify_ui_scaling_factor_changed (MetaBackend *backend)
{
g_signal_emit (backend, signals[UI_SCALING_FACTOR_CHANGED], 0);
}

View File

@@ -37,8 +37,7 @@
struct _MetaCursorRendererPrivate
{
float current_x;
float current_y;
int current_x, current_y;
MetaCursorSprite *displayed_cursor;
MetaOverlay *stage_overlay;
@@ -70,7 +69,7 @@ queue_redraw (MetaCursorRenderer *renderer,
MetaBackend *backend = meta_get_backend ();
ClutterActor *stage = meta_backend_get_stage (backend);
CoglTexture *texture;
ClutterRect rect = { 0 };
MetaRectangle rect = { 0 };
if (cursor_sprite)
rect = meta_cursor_renderer_calculate_rect (renderer, cursor_sprite);
@@ -160,7 +159,7 @@ meta_cursor_renderer_init (MetaCursorRenderer *renderer)
NULL);
}
ClutterRect
MetaRectangle
meta_cursor_renderer_calculate_rect (MetaCursorRenderer *renderer,
MetaCursorSprite *cursor_sprite)
{
@@ -173,22 +172,18 @@ meta_cursor_renderer_calculate_rect (MetaCursorRenderer *renderer,
texture = meta_cursor_sprite_get_cogl_texture (cursor_sprite);
if (!texture)
return (ClutterRect) { 0 };
return (MetaRectangle) { 0 };
meta_cursor_sprite_get_hotspot (cursor_sprite, &hot_x, &hot_y);
texture_scale = meta_cursor_sprite_get_texture_scale (cursor_sprite);
width = cogl_texture_get_width (texture);
height = cogl_texture_get_height (texture);
return (ClutterRect) {
.origin = {
.x = priv->current_x - (hot_x * texture_scale),
.y = priv->current_y - (hot_y * texture_scale)
},
.size = {
.width = width * texture_scale,
.height = height * texture_scale
}
return (MetaRectangle) {
.x = (int)roundf (priv->current_x - (hot_x * texture_scale)),
.y = (int)roundf (priv->current_y - (hot_y * texture_scale)),
.width = (int)roundf (width * texture_scale),
.height = (int)roundf (height * texture_scale),
};
}
@@ -202,8 +197,8 @@ update_cursor (MetaCursorRenderer *renderer,
if (cursor_sprite)
meta_cursor_sprite_prepare_at (cursor_sprite,
(int) priv->current_x,
(int) priv->current_y);
priv->current_x,
priv->current_y);
handled_by_backend =
META_CURSOR_RENDERER_GET_CLASS (renderer)->update_cursor (renderer,
@@ -251,8 +246,7 @@ meta_cursor_renderer_force_update (MetaCursorRenderer *renderer)
void
meta_cursor_renderer_set_position (MetaCursorRenderer *renderer,
float x,
float y)
int x, int y)
{
MetaCursorRendererPrivate *priv = meta_cursor_renderer_get_instance_private (renderer);

View File

@@ -60,14 +60,13 @@ void meta_cursor_renderer_set_cursor (MetaCursorRenderer *renderer,
MetaCursorSprite *cursor_sprite);
void meta_cursor_renderer_set_position (MetaCursorRenderer *renderer,
float x,
float y);
int x, int y);
void meta_cursor_renderer_force_update (MetaCursorRenderer *renderer);
MetaCursorSprite * meta_cursor_renderer_get_cursor (MetaCursorRenderer *renderer);
ClutterRect meta_cursor_renderer_calculate_rect (MetaCursorRenderer *renderer,
MetaCursorSprite *cursor_sprite);
MetaRectangle meta_cursor_renderer_calculate_rect (MetaCursorRenderer *renderer,
MetaCursorSprite *cursor_sprite);
#ifdef HAVE_WAYLAND
void meta_cursor_renderer_realize_cursor_from_wl_buffer (MetaCursorRenderer *renderer,

View File

@@ -62,8 +62,8 @@ void meta_cursor_tracker_set_root_cursor (MetaCursorTracker *tracker,
MetaCursorSprite *cursor_sprite);
void meta_cursor_tracker_update_position (MetaCursorTracker *tracker,
float new_x,
float new_y);
int new_x,
int new_y);
MetaCursorSprite * meta_cursor_tracker_get_displayed_cursor (MetaCursorTracker *tracker);

View File

@@ -350,8 +350,8 @@ meta_cursor_tracker_set_root_cursor (MetaCursorTracker *tracker,
void
meta_cursor_tracker_update_position (MetaCursorTracker *tracker,
float new_x,
float new_y)
int new_x,
int new_y)
{
MetaBackend *backend = meta_get_backend ();
MetaCursorRenderer *cursor_renderer =

View File

@@ -31,9 +31,20 @@
#include <libwacom/libwacom.h>
#endif
#define META_TYPE_INPUT_SETTINGS (meta_input_settings_get_type ())
G_DECLARE_DERIVABLE_TYPE (MetaInputSettings, meta_input_settings,
META, INPUT_SETTINGS, GObject)
#define META_TYPE_INPUT_SETTINGS (meta_input_settings_get_type ())
#define META_INPUT_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_INPUT_SETTINGS, MetaInputSettings))
#define META_INPUT_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_INPUT_SETTINGS, MetaInputSettingsClass))
#define META_IS_INPUT_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_INPUT_SETTINGS))
#define META_IS_INPUT_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_INPUT_SETTINGS))
#define META_INPUT_SETTINGS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_INPUT_SETTINGS, MetaInputSettingsClass))
typedef struct _MetaInputSettings MetaInputSettings;
typedef struct _MetaInputSettingsClass MetaInputSettingsClass;
struct _MetaInputSettings
{
GObject parent_instance;
};
struct _MetaInputSettingsClass
{
@@ -54,9 +65,6 @@ struct _MetaInputSettingsClass
void (* set_tap_enabled) (MetaInputSettings *settings,
ClutterInputDevice *device,
gboolean enabled);
void (* set_disable_while_typing) (MetaInputSettings *settings,
ClutterInputDevice *device,
gboolean enabled);
void (* set_invert_scroll) (MetaInputSettings *settings,
ClutterInputDevice *device,
gboolean inverted);
@@ -109,10 +117,15 @@ struct _MetaInputSettingsClass
ClutterInputDeviceTool *tool,
GDesktopStylusButtonAction primary,
GDesktopStylusButtonAction secondary);
gboolean (* has_two_finger_scroll) (MetaInputSettings *settings,
ClutterInputDevice *device);
};
GType meta_input_settings_get_type (void) G_GNUC_CONST;
MetaInputSettings * meta_input_settings_create (void);
GSettings * meta_input_settings_get_tablet_settings (MetaInputSettings *settings,
ClutterInputDevice *device);
MetaLogicalMonitor * meta_input_settings_get_tablet_logical_monitor (MetaInputSettings *settings,
@@ -125,12 +138,11 @@ gboolean meta_input_settings_is_pad_button_grabbed (MetaIn
ClutterInputDevice *pad,
guint button);
gboolean meta_input_settings_handle_pad_event (MetaInputSettings *input_settings,
const ClutterEvent *event);
gchar * meta_input_settings_get_pad_action_label (MetaInputSettings *input_settings,
ClutterInputDevice *pad,
MetaPadActionType action,
guint number);
gboolean meta_input_settings_handle_pad_button (MetaInputSettings *input_settings,
const ClutterPadButtonEvent *event);
gchar * meta_input_settings_get_pad_button_action_label (MetaInputSettings *input_settings,
ClutterInputDevice *pad,
guint button);
#ifdef HAVE_LIBWACOM
WacomDevice * meta_input_settings_get_tablet_wacom_device (MetaInputSettings *settings,

View File

@@ -33,6 +33,12 @@
#include "meta-input-settings-private.h"
#include "backends/meta-logical-monitor.h"
#include "backends/meta-monitor.h"
#include "x11/meta-input-settings-x11.h"
#ifdef HAVE_NATIVE_BACKEND
#include "native/meta-backend-native.h"
#include "native/meta-input-settings-native.h"
#endif
#include <glib/gi18n-lib.h>
#include <meta/util.h>
@@ -47,11 +53,9 @@ struct _DeviceMappingInfo
MetaInputSettings *input_settings;
ClutterInputDevice *device;
GSettings *settings;
guint changed_id;
#ifdef HAVE_LIBWACOM
WacomDevice *wacom_device;
#endif
guint *group_modes;
};
struct _MetaInputSettingsPrivate
@@ -75,14 +79,6 @@ struct _MetaInputSettingsPrivate
#endif
GHashTable *two_finger_devices;
/* Pad ring/strip emission */
struct {
ClutterInputDevice *pad;
MetaPadActionType action;
guint number;
gdouble value;
} last_pad_action_info;
};
typedef void (*ConfigBoolFunc) (MetaInputSettings *input_settings,
@@ -95,14 +91,6 @@ typedef void (*ConfigUintFunc) (MetaInputSettings *input_settings,
ClutterInputDevice *device,
guint value);
typedef enum {
META_PAD_DIRECTION_NONE = -1,
META_PAD_DIRECTION_UP = 0,
META_PAD_DIRECTION_DOWN,
META_PAD_DIRECTION_CW,
META_PAD_DIRECTION_CCW,
} MetaPadDirection;
G_DEFINE_TYPE_WITH_PRIVATE (MetaInputSettings, meta_input_settings, G_TYPE_OBJECT)
static GSList *
@@ -460,44 +448,6 @@ update_device_natural_scroll (MetaInputSettings *input_settings,
}
}
static void
update_touchpad_disable_while_typing (MetaInputSettings *input_settings,
ClutterInputDevice *device)
{
GSettings *settings;
MetaInputSettingsClass *input_settings_class;
MetaInputSettingsPrivate *priv;
gboolean enabled;
const gchar *key = "disable-while-typing";
if (device &&
clutter_input_device_get_device_type (device) != CLUTTER_TOUCHPAD_DEVICE)
return;
priv = meta_input_settings_get_instance_private (input_settings);
input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings);
enabled = g_settings_get_boolean (priv->touchpad_settings, key);
if (device)
{
settings = get_settings_for_device_type (input_settings,
clutter_input_device_get_device_type (device));
if (!settings)
return;
settings_device_set_bool_setting (input_settings, device,
input_settings_class->set_disable_while_typing,
enabled);
}
else
{
settings_set_bool_setting (input_settings, CLUTTER_TOUCHPAD_DEVICE,
input_settings_class->set_disable_while_typing,
enabled);
}
}
static void
update_touchpad_tap_enabled (MetaInputSettings *input_settings,
ClutterInputDevice *device)
@@ -750,7 +700,7 @@ logical_monitor_has_monitor (MetaMonitorManager *monitor_manager,
GList *monitors;
GList *l;
monitors = meta_logical_monitor_get_monitors (logical_monitor);
monitors = meta_monitor_manager_get_monitors (monitor_manager);
for (l = monitors; l; l = l->next)
{
MetaMonitor *monitor = l->data;
@@ -875,7 +825,7 @@ update_device_display (MetaInputSettings *input_settings,
input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings);
/* If mapping is relative, the device can move on all displays */
if (clutter_input_device_get_device_type (device) == CLUTTER_TOUCHSCREEN_DEVICE ||
if (clutter_input_device_get_device_type (device) != CLUTTER_TABLET_DEVICE ||
clutter_input_device_get_mapping_mode (device) ==
CLUTTER_INPUT_DEVICE_MAPPING_ABSOLUTE)
logical_monitor = meta_input_settings_find_logical_monitor (input_settings,
@@ -1039,8 +989,6 @@ meta_input_settings_changed_cb (GSettings *settings,
update_device_natural_scroll (input_settings, NULL);
else if (strcmp (key, "tap-to-click") == 0)
update_touchpad_tap_enabled (input_settings, NULL);
else if (strcmp(key, "disable-while-typing") == 0)
update_touchpad_disable_while_typing (input_settings, NULL);
else if (strcmp (key, "send-events") == 0)
update_touchpad_send_events (input_settings, NULL);
else if (strcmp (key, "edge-scrolling-enabled") == 0)
@@ -1087,15 +1035,10 @@ static void
apply_mappable_device_settings (MetaInputSettings *input_settings,
DeviceMappingInfo *info)
{
ClutterInputDeviceType device_type;
update_device_display (input_settings, info->settings, info->device);
device_type = clutter_input_device_get_device_type (info->device);
if (device_type == CLUTTER_TABLET_DEVICE ||
device_type == CLUTTER_PEN_DEVICE ||
device_type == CLUTTER_ERASER_DEVICE ||
device_type == CLUTTER_PAD_DEVICE)
if (clutter_input_device_get_device_type (info->device) == CLUTTER_TABLET_DEVICE ||
clutter_input_device_get_device_type (info->device) == CLUTTER_PAD_DEVICE)
{
update_tablet_mapping (input_settings, info->settings, info->device);
update_tablet_area (input_settings, info->settings, info->device);
@@ -1178,58 +1121,20 @@ lookup_tool_settings (ClutterInputDeviceTool *tool,
}
static GSettings *
lookup_pad_action_settings (ClutterInputDevice *device,
MetaPadActionType action,
guint number,
MetaPadDirection direction,
gint mode)
lookup_pad_button_settings (ClutterInputDevice *device,
guint button)
{
const gchar *vendor, *product, *action_type, *detail_type = NULL;
const gchar *vendor, *product;
GSettings *settings;
GString *path;
gchar action_label;
gchar *path;
vendor = clutter_input_device_get_vendor_id (device);
product = clutter_input_device_get_product_id (device);
action_label = 'A' + number;
switch (action)
{
case META_PAD_ACTION_BUTTON:
action_type = "button";
break;
case META_PAD_ACTION_RING:
g_assert (direction == META_PAD_DIRECTION_CW ||
direction == META_PAD_DIRECTION_CCW);
action_type = "ring";
detail_type = (direction == META_PAD_DIRECTION_CW) ? "cw" : "ccw";
break;
case META_PAD_ACTION_STRIP:
g_assert (direction == META_PAD_DIRECTION_UP ||
direction == META_PAD_DIRECTION_DOWN);
action_type = "strip";
detail_type = (direction == META_PAD_DIRECTION_UP) ? "up" : "down";
break;
default:
return NULL;
}
path = g_string_new (NULL);
g_string_append_printf (path, "/org/gnome/desktop/peripherals/tablets/%s:%s/%s%c",
vendor, product, action_type, action_label);
if (detail_type)
g_string_append_printf (path, "-%s", detail_type);
if (mode >= 0)
g_string_append_printf (path, "-mode-%d", mode);
g_string_append_c (path, '/');
path = g_strdup_printf ("/org/gnome/desktop/peripherals/tablets/%s:%s/button%c/",
vendor, product, 'A' + button);
settings = g_settings_new_with_path ("org.gnome.desktop.peripherals.tablet.pad-button",
path->str);
g_string_free (path, TRUE);
path);
g_free (path);
return settings;
}
@@ -1258,9 +1163,7 @@ device_mapping_info_free (DeviceMappingInfo *info)
if (info->wacom_device)
libwacom_destroy (info->wacom_device);
#endif
g_signal_handler_disconnect (info->settings, info->changed_id);
g_object_unref (info->settings);
g_free (info->group_modes);
g_slice_free (DeviceMappingInfo, info);
}
@@ -1304,15 +1207,8 @@ check_add_mappable_device (MetaInputSettings *input_settings,
}
#endif
if (clutter_input_device_get_device_type (device) == CLUTTER_PAD_DEVICE)
{
info->group_modes =
g_new0 (guint, clutter_input_device_get_n_mode_groups (device));
}
info->changed_id = g_signal_connect (settings, "changed",
G_CALLBACK (mapped_device_changed_cb),
info);
g_signal_connect (settings, "changed",
G_CALLBACK (mapped_device_changed_cb), info);
g_hash_table_insert (priv->mappable_devices, device, info);
@@ -1338,7 +1234,6 @@ apply_device_settings (MetaInputSettings *input_settings,
update_touchpad_left_handed (input_settings, device);
update_touchpad_tap_enabled (input_settings, device);
update_touchpad_disable_while_typing (input_settings, device);
update_touchpad_send_events (input_settings, device);
update_touchpad_two_finger_scroll (input_settings, device);
update_touchpad_edge_scroll (input_settings, device);
@@ -1583,6 +1478,23 @@ meta_input_settings_init (MetaInputSettings *settings)
priv->two_finger_devices = g_hash_table_new (NULL, NULL);
}
MetaInputSettings *
meta_input_settings_create (void)
{
#ifdef HAVE_NATIVE_BACKEND
MetaBackend *backend;
backend = meta_get_backend ();
if (META_IS_BACKEND_NATIVE (backend))
return g_object_new (META_TYPE_INPUT_SETTINGS_NATIVE, NULL);
#endif
if (!meta_is_wayland_compositor ())
return g_object_new (META_TYPE_INPUT_SETTINGS_X11, NULL);
return NULL;
}
GSettings *
meta_input_settings_get_tablet_settings (MetaInputSettings *settings,
ClutterInputDevice *device)
@@ -1651,8 +1563,7 @@ meta_input_settings_get_pad_button_action (MetaInputSettings *input_settings,
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (pad),
G_DESKTOP_PAD_BUTTON_ACTION_NONE);
settings = lookup_pad_action_settings (pad, META_PAD_ACTION_BUTTON,
button, META_PAD_DIRECTION_NONE, -1);
settings = lookup_pad_button_settings (pad, button);
action = g_settings_get_enum (settings, "action");
g_object_unref (settings);
@@ -1708,7 +1619,7 @@ cycle_logical_monitors (MetaInputSettings *settings,
if (l->next)
*next_logical_monitor = l->next->data;
else
*next_logical_monitor = NULL;
*next_logical_monitor = logical_monitors->data;
}
return TRUE;
@@ -1801,20 +1712,24 @@ emulate_modifiers (ClutterVirtualInputDevice *device,
static void
meta_input_settings_emulate_keybinding (MetaInputSettings *input_settings,
const gchar *accel,
ClutterInputDevice *pad,
guint button,
gboolean is_press)
{
MetaInputSettingsPrivate *priv;
ClutterKeyState state;
GSettings *settings;
guint key, mods;
if (!accel || !*accel)
return;
gchar *accel;
priv = meta_input_settings_get_instance_private (input_settings);
settings = lookup_pad_button_settings (pad, button);
accel = g_settings_get_string (settings, "keybinding");
g_object_unref (settings);
/* FIXME: This is appalling */
gtk_accelerator_parse (accel, &key, &mods);
g_free (accel);
if (!priv->virtual_pad_keyboard)
{
@@ -1851,21 +1766,20 @@ meta_input_settings_is_pad_button_grabbed (MetaInputSettings *input_settings,
G_DESKTOP_PAD_BUTTON_ACTION_NONE);
}
static gboolean
gboolean
meta_input_settings_handle_pad_button (MetaInputSettings *input_settings,
ClutterInputDevice *pad,
const ClutterPadButtonEvent *event)
{
GDesktopPadButtonAction action;
ClutterInputDevice *pad;
gint button, group, mode;
gboolean is_press;
GSettings *settings;
gchar *accel;
g_return_val_if_fail (META_IS_INPUT_SETTINGS (input_settings), FALSE);
g_return_val_if_fail (event->type == CLUTTER_PAD_BUTTON_PRESS ||
event->type == CLUTTER_PAD_BUTTON_RELEASE, FALSE);
pad = clutter_event_get_source_device ((ClutterEvent *) event);
button = event->button;
mode = event->mode;
group = clutter_input_device_get_mode_switch_button_group (pad, button);
@@ -1875,19 +1789,18 @@ meta_input_settings_handle_pad_button (MetaInputSettings *input_settin
{
guint n_modes = clutter_input_device_get_group_n_modes (pad, group);
const gchar *pretty_name = NULL;
#ifdef HAVE_LIBWACOM
MetaInputSettingsPrivate *priv;
DeviceMappingInfo *info;
priv = meta_input_settings_get_instance_private (input_settings);
info = g_hash_table_lookup (priv->mappable_devices, pad);
#ifdef HAVE_LIBWACOM
if (info && info->wacom_device)
pretty_name = libwacom_get_name (info->wacom_device);
#endif
meta_display_notify_pad_group_switch (meta_get_display (), pad,
pretty_name, group, mode, n_modes);
info->group_modes[group] = mode;
}
action = meta_input_settings_get_pad_button_action (input_settings, pad, button);
@@ -1903,12 +1816,8 @@ meta_input_settings_handle_pad_button (MetaInputSettings *input_settin
meta_display_request_pad_osd (meta_get_display (), pad, FALSE);
return TRUE;
case G_DESKTOP_PAD_BUTTON_ACTION_KEYBINDING:
settings = lookup_pad_action_settings (pad, META_PAD_ACTION_BUTTON,
button, META_PAD_DIRECTION_NONE, -1);
accel = g_settings_get_string (settings, "keybinding");
meta_input_settings_emulate_keybinding (input_settings, accel, is_press);
g_object_unref (settings);
g_free (accel);
meta_input_settings_emulate_keybinding (input_settings, pad,
button, is_press);
return TRUE;
case G_DESKTOP_PAD_BUTTON_ACTION_NONE:
default:
@@ -1916,189 +1825,10 @@ meta_input_settings_handle_pad_button (MetaInputSettings *input_settin
}
}
static gboolean
meta_input_settings_handle_pad_action (MetaInputSettings *input_settings,
ClutterInputDevice *pad,
MetaPadActionType action,
guint number,
MetaPadDirection direction,
guint mode)
{
GSettings *settings;
gboolean handled = FALSE;
gchar *accel;
settings = lookup_pad_action_settings (pad, action, number, direction, mode);
accel = g_settings_get_string (settings, "keybinding");
if (accel && *accel)
{
meta_input_settings_emulate_keybinding (input_settings, accel, TRUE);
meta_input_settings_emulate_keybinding (input_settings, accel, FALSE);
handled = TRUE;
}
g_object_unref (settings);
g_free (accel);
return handled;
}
static gboolean
meta_input_settings_get_pad_action_direction (MetaInputSettings *input_settings,
const ClutterEvent *event,
MetaPadDirection *direction)
{
MetaInputSettingsPrivate *priv;
ClutterInputDevice *pad = clutter_event_get_device (event);
MetaPadActionType pad_action;
gboolean has_direction = FALSE;
MetaPadDirection inc_dir, dec_dir;
guint number;
gdouble value;
priv = meta_input_settings_get_instance_private (input_settings);
*direction = META_PAD_DIRECTION_NONE;
switch (event->type)
{
case CLUTTER_PAD_RING:
pad_action = META_PAD_ACTION_RING;
number = event->pad_ring.ring_number;
value = event->pad_ring.angle;
inc_dir = META_PAD_DIRECTION_CW;
dec_dir = META_PAD_DIRECTION_CCW;
break;
case CLUTTER_PAD_STRIP:
pad_action = META_PAD_ACTION_STRIP;
number = event->pad_strip.strip_number;
value = event->pad_strip.value;
inc_dir = META_PAD_DIRECTION_DOWN;
dec_dir = META_PAD_DIRECTION_UP;
break;
default:
return FALSE;
}
if (priv->last_pad_action_info.pad == pad &&
priv->last_pad_action_info.action == pad_action &&
priv->last_pad_action_info.number == number &&
value >= 0 && priv->last_pad_action_info.value >= 0)
{
*direction = (value - priv->last_pad_action_info.value) > 0 ?
inc_dir : dec_dir;
has_direction = TRUE;
}
priv->last_pad_action_info.pad = pad;
priv->last_pad_action_info.action = pad_action;
priv->last_pad_action_info.number = number;
priv->last_pad_action_info.value = value;
return has_direction;
}
gboolean
meta_input_settings_handle_pad_event (MetaInputSettings *input_settings,
const ClutterEvent *event)
{
ClutterInputDevice *pad;
MetaPadDirection direction = META_PAD_DIRECTION_NONE;
pad = clutter_event_get_source_device ((ClutterEvent *) event);
switch (event->type)
{
case CLUTTER_PAD_BUTTON_PRESS:
case CLUTTER_PAD_BUTTON_RELEASE:
return meta_input_settings_handle_pad_button (input_settings, pad,
&event->pad_button);
case CLUTTER_PAD_RING:
if (!meta_input_settings_get_pad_action_direction (input_settings,
event, &direction))
return FALSE;
return meta_input_settings_handle_pad_action (input_settings, pad,
META_PAD_ACTION_RING,
event->pad_ring.ring_number,
direction,
event->pad_ring.mode);
case CLUTTER_PAD_STRIP:
if (!meta_input_settings_get_pad_action_direction (input_settings,
event, &direction))
return FALSE;
return meta_input_settings_handle_pad_action (input_settings, pad,
META_PAD_ACTION_STRIP,
event->pad_strip.strip_number,
direction,
event->pad_strip.mode);
default:
return FALSE;
}
}
static gchar *
compose_directional_action_label (GSettings *direction1,
GSettings *direction2)
{
gchar *accel1, *accel2, *str = NULL;
accel1 = g_settings_get_string (direction1, "keybinding");
accel2 = g_settings_get_string (direction2, "keybinding");
if (accel1 && *accel1 && accel2 && *accel2)
str = g_strdup_printf ("%s / %s", accel1, accel2);
g_free (accel1);
g_free (accel2);
return str;
}
static gchar *
meta_input_settings_get_ring_label (MetaInputSettings *settings,
ClutterInputDevice *pad,
guint number,
guint mode)
{
GSettings *settings1, *settings2;
gchar *label;
/* We only allow keybinding actions with those */
settings1 = lookup_pad_action_settings (pad, META_PAD_ACTION_RING, number,
META_PAD_DIRECTION_CW, mode);
settings2 = lookup_pad_action_settings (pad, META_PAD_ACTION_RING, number,
META_PAD_DIRECTION_CCW, mode);
label = compose_directional_action_label (settings1, settings2);
g_object_unref (settings1);
g_object_unref (settings2);
return label;
}
static gchar *
meta_input_settings_get_strip_label (MetaInputSettings *settings,
ClutterInputDevice *pad,
guint number,
guint mode)
{
GSettings *settings1, *settings2;
gchar *label;
/* We only allow keybinding actions with those */
settings1 = lookup_pad_action_settings (pad, META_PAD_ACTION_STRIP, number,
META_PAD_DIRECTION_UP, mode);
settings2 = lookup_pad_action_settings (pad, META_PAD_ACTION_STRIP, number,
META_PAD_DIRECTION_DOWN, mode);
label = compose_directional_action_label (settings1, settings2);
g_object_unref (settings1);
g_object_unref (settings2);
return label;
}
static gchar *
meta_input_settings_get_button_label (MetaInputSettings *input_settings,
ClutterInputDevice *pad,
guint button)
gchar *
meta_input_settings_get_pad_button_action_label (MetaInputSettings *input_settings,
ClutterInputDevice *pad,
guint button)
{
GDesktopPadButtonAction action;
gint group;
@@ -2127,8 +1857,7 @@ meta_input_settings_get_button_label (MetaInputSettings *input_settings,
GSettings *settings;
gchar *accel;
settings = lookup_pad_action_settings (pad, META_PAD_ACTION_BUTTON,
button, META_PAD_DIRECTION_NONE, -1);
settings = lookup_pad_button_settings (pad, button);
accel = g_settings_get_string (settings, "keybinding");
g_object_unref (settings);
@@ -2146,55 +1875,3 @@ meta_input_settings_get_button_label (MetaInputSettings *input_settings,
return NULL;
}
}
static guint
get_current_pad_mode (MetaInputSettings *input_settings,
ClutterInputDevice *pad,
MetaPadActionType action_type,
guint number)
{
MetaInputSettingsPrivate *priv;
DeviceMappingInfo *info;
guint group = 0, n_groups;
priv = meta_input_settings_get_instance_private (input_settings);
info = g_hash_table_lookup (priv->mappable_devices, pad);
n_groups = clutter_input_device_get_n_mode_groups (pad);
if (!info->group_modes || n_groups == 0)
return 0;
if (action_type == META_PAD_ACTION_RING ||
action_type == META_PAD_ACTION_STRIP)
{
/* Assume features are evenly distributed in groups */
group = number % n_groups;
}
return info->group_modes[group];
}
gchar *
meta_input_settings_get_pad_action_label (MetaInputSettings *input_settings,
ClutterInputDevice *pad,
MetaPadActionType action_type,
guint number)
{
guint mode;
switch (action_type)
{
case META_PAD_ACTION_BUTTON:
return meta_input_settings_get_button_label (input_settings, pad, number);
case META_PAD_ACTION_RING:
mode = get_current_pad_mode (input_settings, pad, action_type, number);
return meta_input_settings_get_ring_label (input_settings, pad,
number, mode);
case META_PAD_ACTION_STRIP:
mode = get_current_pad_mode (input_settings, pad, action_type, number);
return meta_input_settings_get_strip_label (input_settings, pad,
number, mode);
}
return NULL;
}

View File

@@ -107,15 +107,21 @@ MetaLogicalMonitor *
meta_logical_monitor_new_derived (MetaMonitorManager *monitor_manager,
MetaMonitor *monitor,
MetaRectangle *layout,
float scale,
int monitor_number)
{
MetaLogicalMonitor *logical_monitor;
MetaOutput *main_output;
MetaMonitorMode *monitor_mode;
int scale;
MetaMonitorTransform transform;
logical_monitor = g_object_new (META_TYPE_LOGICAL_MONITOR, NULL);
monitor_mode = meta_monitor_get_current_mode (monitor);
scale = meta_monitor_manager_calculate_monitor_mode_scale (monitor_manager,
monitor,
monitor_mode);
transform = derive_monitor_transform (monitor);
main_output = meta_monitor_get_main_output (monitor);
@@ -175,7 +181,7 @@ meta_logical_monitor_make_primary (MetaLogicalMonitor *logical_monitor)
logical_monitor->is_primary = TRUE;
}
float
int
meta_logical_monitor_get_scale (MetaLogicalMonitor *logical_monitor)
{
return logical_monitor->scale;

View File

@@ -40,7 +40,7 @@ struct _MetaLogicalMonitor
gboolean is_primary;
gboolean is_presentation; /* XXX: not yet used */
gboolean in_fullscreen;
float scale;
int scale;
MetaMonitorTransform transform;
/* The primary or first output for this monitor, 0 if we can't figure out.
@@ -68,7 +68,6 @@ MetaLogicalMonitor * meta_logical_monitor_new (MetaMonitorManager *monitor
MetaLogicalMonitor * meta_logical_monitor_new_derived (MetaMonitorManager *monitor_manager,
MetaMonitor *monitor,
MetaRectangle *layout,
float scale,
int monitor_number);
void meta_logical_monitor_add_monitor (MetaLogicalMonitor *logical_monitor,
@@ -78,7 +77,7 @@ gboolean meta_logical_monitor_is_primary (MetaLogicalMonitor *logical_monitor);
void meta_logical_monitor_make_primary (MetaLogicalMonitor *logical_monitor);
float meta_logical_monitor_get_scale (MetaLogicalMonitor *logical_monitor);
int meta_logical_monitor_get_scale (MetaLogicalMonitor *logical_monitor);
GList * meta_logical_monitor_get_monitors (MetaLogicalMonitor *logical_monitor);

View File

@@ -483,26 +483,19 @@ create_preferred_logical_monitor_config (MetaMonitorManager *monitor_ma
MetaMonitor *monitor,
int x,
int y,
MetaLogicalMonitorConfig *primary_logical_monitor_config,
MetaLogicalMonitorLayoutMode layout_mode)
{
MetaMonitorMode *mode;
int width, height;
float scale;
int scale;
MetaMonitorConfig *monitor_config;
MetaLogicalMonitorConfig *logical_monitor_config;
mode = meta_monitor_get_preferred_mode (monitor);
meta_monitor_mode_get_resolution (mode, &width, &height);
if ((meta_monitor_manager_get_capabilities (monitor_manager) &
META_MONITOR_MANAGER_CAPABILITY_GLOBAL_SCALE_REQUIRED) &&
primary_logical_monitor_config)
scale = primary_logical_monitor_config->scale;
else
scale = meta_monitor_manager_calculate_monitor_mode_scale (monitor_manager,
monitor,
mode);
scale = meta_monitor_manager_calculate_monitor_mode_scale (monitor_manager,
monitor,
mode);
switch (layout_mode)
{
@@ -553,7 +546,6 @@ meta_monitor_config_manager_create_linear (MetaMonitorConfigManager *config_mana
create_preferred_logical_monitor_config (monitor_manager,
primary_monitor,
0, 0,
NULL,
layout_mode);
primary_logical_monitor_config->is_primary = TRUE;
logical_monitor_configs = g_list_append (NULL,
@@ -577,7 +569,6 @@ meta_monitor_config_manager_create_linear (MetaMonitorConfigManager *config_mana
create_preferred_logical_monitor_config (monitor_manager,
monitor,
x, 0,
primary_logical_monitor_config,
layout_mode);
logical_monitor_configs = g_list_append (logical_monitor_configs,
logical_monitor_config);
@@ -607,7 +598,6 @@ meta_monitor_config_manager_create_fallback (MetaMonitorConfigManager *config_ma
create_preferred_logical_monitor_config (monitor_manager,
primary_monitor,
0, 0,
NULL,
layout_mode);
primary_logical_monitor_config->is_primary = TRUE;
logical_monitor_configs = g_list_append (NULL,
@@ -625,7 +615,6 @@ meta_monitor_config_manager_create_suggested (MetaMonitorConfigManager *config_m
MetaLogicalMonitorLayoutMode layout_mode;
GList *logical_monitor_configs;
GList *region;
int x, y;
GList *monitors;
GList *l;
@@ -633,30 +622,16 @@ meta_monitor_config_manager_create_suggested (MetaMonitorConfigManager *config_m
if (!primary_monitor)
return NULL;
if (!meta_monitor_get_suggested_position (primary_monitor, &x, &y))
return NULL;
layout_mode = meta_monitor_manager_get_default_layout_mode (monitor_manager);
primary_logical_monitor_config =
create_preferred_logical_monitor_config (monitor_manager,
primary_monitor,
x, y,
NULL,
layout_mode);
primary_logical_monitor_config->is_primary = TRUE;
logical_monitor_configs = g_list_append (NULL,
primary_logical_monitor_config);
region = g_list_prepend (NULL, &primary_logical_monitor_config->layout);
logical_monitor_configs = NULL;
region = NULL;
monitors = meta_monitor_manager_get_monitors (monitor_manager);
for (l = monitors; l; l = l->next)
{
MetaMonitor *monitor = l->data;
MetaLogicalMonitorConfig *logical_monitor_config;
if (monitor == primary_monitor)
continue;
int x, y;
if (!meta_monitor_get_suggested_position (monitor, &x, &y))
continue;
@@ -665,7 +640,6 @@ meta_monitor_config_manager_create_suggested (MetaMonitorConfigManager *config_m
create_preferred_logical_monitor_config (monitor_manager,
monitor,
x, y,
primary_logical_monitor_config,
layout_mode);
logical_monitor_configs = g_list_append (logical_monitor_configs,
logical_monitor_config);
@@ -681,6 +655,9 @@ meta_monitor_config_manager_create_suggested (MetaMonitorConfigManager *config_m
}
region = g_list_prepend (region, &logical_monitor_config->layout);
if (monitor == primary_monitor)
primary_logical_monitor_config = logical_monitor_config;
}
g_list_free (region);
@@ -688,268 +665,15 @@ meta_monitor_config_manager_create_suggested (MetaMonitorConfigManager *config_m
if (!logical_monitor_configs)
return NULL;
return meta_monitors_config_new (logical_monitor_configs, layout_mode);
}
if (!primary_logical_monitor_config)
primary_logical_monitor_config =
g_list_first (logical_monitor_configs)->data;
static MetaMonitorsConfig *
create_for_builtin_display_rotation (MetaMonitorConfigManager *config_manager,
gboolean rotate,
MetaMonitorTransform transform)
{
MetaLogicalMonitorConfig *logical_monitor_config;
MetaLogicalMonitorConfig *current_logical_monitor_config;
MetaMonitorConfig *monitor_config;
MetaMonitorConfig *current_monitor_config;
if (!meta_monitor_manager_get_is_builtin_display_on (config_manager->monitor_manager))
return NULL;
if (!config_manager->current_config)
return NULL;
if (g_list_length (config_manager->current_config->logical_monitor_configs) != 1)
return NULL;
current_logical_monitor_config = config_manager->current_config->logical_monitor_configs->data;
if (rotate)
transform = (current_logical_monitor_config->transform + 1) % META_MONITOR_TRANSFORM_FLIPPED;
if (current_logical_monitor_config->transform == transform)
return NULL;
if (g_list_length (current_logical_monitor_config->monitor_configs) != 1)
return NULL;
current_monitor_config = current_logical_monitor_config->monitor_configs->data;
monitor_config = g_new0 (MetaMonitorConfig, 1);
*monitor_config = (MetaMonitorConfig) {
.monitor_spec = meta_monitor_spec_clone (current_monitor_config->monitor_spec),
.mode_spec = g_memdup (current_monitor_config->mode_spec, sizeof (MetaMonitorModeSpec)),
.enable_underscanning = current_monitor_config->enable_underscanning
};
logical_monitor_config = g_memdup (current_logical_monitor_config, sizeof (MetaLogicalMonitorConfig));
logical_monitor_config->monitor_configs = g_list_append (NULL, monitor_config);
logical_monitor_config->transform = transform;
return meta_monitors_config_new (g_list_append (NULL, logical_monitor_config),
config_manager->current_config->layout_mode);
}
MetaMonitorsConfig *
meta_monitor_config_manager_create_for_orientation (MetaMonitorConfigManager *config_manager,
MetaMonitorTransform transform)
{
return create_for_builtin_display_rotation (config_manager, FALSE, transform);
}
MetaMonitorsConfig *
meta_monitor_config_manager_create_for_rotate_monitor (MetaMonitorConfigManager *config_manager)
{
return create_for_builtin_display_rotation (config_manager, TRUE, META_MONITOR_TRANSFORM_NORMAL);
}
static MetaMonitorsConfig *
create_for_switch_config_all_mirror (MetaMonitorConfigManager *config_manager)
{
MetaMonitorManager *monitor_manager = config_manager->monitor_manager;
MetaLogicalMonitorConfig *logical_monitor_config = NULL;
GList *monitor_configs = NULL;
gint common_mode_w = 0, common_mode_h = 0;
float best_scale = 1.0;
MetaMonitor *monitor;
GList *modes;
GList *monitors;
GList *l;
monitors = meta_monitor_manager_get_monitors (monitor_manager);
monitor = monitors->data;
modes = meta_monitor_get_modes (monitor);
for (l = modes; l; l = l->next)
{
MetaMonitorMode *mode = l->data;
gboolean common_mode_size = TRUE;
gint mode_w, mode_h;
GList *ll;
meta_monitor_mode_get_resolution (mode, &mode_w, &mode_h);
for (ll = monitors->next; ll; ll = ll->next)
{
MetaMonitor *monitor_b = ll->data;
gboolean have_same_mode_size = FALSE;
GList *mm;
for (mm = meta_monitor_get_modes (monitor_b); mm; mm = mm->next)
{
MetaMonitorMode *mode_b = mm->data;
gint mode_b_w, mode_b_h;
meta_monitor_mode_get_resolution (mode_b, &mode_b_w, &mode_b_h);
if (mode_w == mode_b_w &&
mode_h == mode_b_h)
{
have_same_mode_size = TRUE;
break;
}
}
if (!have_same_mode_size)
{
common_mode_size = FALSE;
break;
}
}
if (common_mode_size &&
common_mode_w * common_mode_h < mode_w * mode_h)
{
common_mode_w = mode_w;
common_mode_h = mode_h;
}
}
if (common_mode_w == 0 || common_mode_h == 0)
return NULL;
for (l = monitors; l; l = l->next)
{
MetaMonitor *monitor = l->data;
MetaMonitorMode *mode = NULL;
GList *ll;
float scale;
for (ll = meta_monitor_get_modes (monitor); ll; ll = ll->next)
{
gint mode_w, mode_h;
mode = ll->data;
meta_monitor_mode_get_resolution (mode, &mode_w, &mode_h);
if (mode_w == common_mode_w && mode_h == common_mode_h)
break;
}
if (!mode)
continue;
scale = meta_monitor_manager_calculate_monitor_mode_scale (monitor_manager, monitor, mode);
best_scale = MAX (best_scale, scale);
monitor_configs = g_list_prepend (monitor_configs, create_monitor_config (monitor, mode));
}
logical_monitor_config = g_new0 (MetaLogicalMonitorConfig, 1);
*logical_monitor_config = (MetaLogicalMonitorConfig) {
.layout = (MetaRectangle) {
.x = 0,
.y = 0,
.width = common_mode_w,
.height = common_mode_h
},
.scale = best_scale,
.monitor_configs = monitor_configs
};
return meta_monitors_config_new (g_list_append (NULL, logical_monitor_config),
meta_monitor_manager_get_default_layout_mode (monitor_manager));
}
static MetaMonitorsConfig *
create_for_switch_config_external (MetaMonitorConfigManager *config_manager)
{
MetaMonitorManager *monitor_manager = config_manager->monitor_manager;
GList *logical_monitor_configs = NULL;
int x = 0;
MetaLogicalMonitorLayoutMode layout_mode;
GList *monitors;
GList *l;
layout_mode = meta_monitor_manager_get_default_layout_mode (monitor_manager);
monitors = meta_monitor_manager_get_monitors (monitor_manager);
for (l = monitors; l; l = l->next)
{
MetaMonitor *monitor = l->data;
MetaLogicalMonitorConfig *logical_monitor_config;
if (meta_monitor_is_laptop_panel (monitor))
continue;
logical_monitor_config =
create_preferred_logical_monitor_config (monitor_manager,
monitor,
x, 0,
NULL,
layout_mode);
logical_monitor_configs = g_list_append (logical_monitor_configs,
logical_monitor_config);
if (x == 0)
logical_monitor_config->is_primary = TRUE;
x += logical_monitor_config->layout.width;
}
return meta_monitors_config_new (logical_monitor_configs, layout_mode);
}
static MetaMonitorsConfig *
create_for_switch_config_builtin (MetaMonitorConfigManager *config_manager)
{
MetaMonitorManager *monitor_manager = config_manager->monitor_manager;
MetaLogicalMonitorLayoutMode layout_mode;
GList *logical_monitor_configs;
MetaLogicalMonitorConfig *primary_logical_monitor_config;
MetaMonitor *monitor;
monitor = meta_monitor_manager_get_laptop_panel (monitor_manager);
if (!monitor)
return NULL;
layout_mode = meta_monitor_manager_get_default_layout_mode (monitor_manager);
primary_logical_monitor_config =
create_preferred_logical_monitor_config (monitor_manager,
monitor,
0, 0,
NULL,
layout_mode);
primary_logical_monitor_config->is_primary = TRUE;
logical_monitor_configs = g_list_append (NULL,
primary_logical_monitor_config);
return meta_monitors_config_new (logical_monitor_configs, layout_mode);
}
MetaMonitorsConfig *
meta_monitor_config_manager_create_for_switch_config (MetaMonitorConfigManager *config_manager,
MetaMonitorSwitchConfigType config_type)
{
MetaMonitorManager *monitor_manager = config_manager->monitor_manager;
if (!meta_monitor_manager_can_switch_config (monitor_manager))
return NULL;
switch (config_type)
{
case META_MONITOR_SWITCH_CONFIG_ALL_MIRROR:
return create_for_switch_config_all_mirror (config_manager);
case META_MONITOR_SWITCH_CONFIG_ALL_LINEAR:
return meta_monitor_config_manager_create_linear (config_manager);
case META_MONITOR_SWITCH_CONFIG_EXTERNAL:
return create_for_switch_config_external (config_manager);
case META_MONITOR_SWITCH_CONFIG_BUILTIN:
return create_for_switch_config_builtin (config_manager);
case META_MONITOR_SWITCH_CONFIG_UNKNOWN:
g_warn_if_reached ();
break;
}
return NULL;
}
void
meta_monitor_config_manager_set_current (MetaMonitorConfigManager *config_manager,
MetaMonitorsConfig *config)
@@ -1202,13 +926,20 @@ meta_verify_monitor_config (MetaMonitorConfig *monitor_config,
gboolean
meta_verify_logical_monitor_config (MetaLogicalMonitorConfig *logical_monitor_config,
MetaLogicalMonitorLayoutMode layout_mode,
MetaMonitorManager *monitor_manager,
GError **error)
{
GList *l;
int expected_mode_width = 0;
int expected_mode_height = 0;
if (logical_monitor_config->scale < 1)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Invalid logical monitor config scale %d",
logical_monitor_config->scale);
return FALSE;
}
if (logical_monitor_config->layout.x < 0 ||
logical_monitor_config->layout.y < 0)
{
@@ -1240,10 +971,8 @@ meta_verify_logical_monitor_config (MetaLogicalMonitorConfig *logical_monitor
switch (layout_mode)
{
case META_LOGICAL_MONITOR_LAYOUT_MODE_LOGICAL:
expected_mode_width = roundf (expected_mode_width *
logical_monitor_config->scale);
expected_mode_height = roundf (expected_mode_height *
logical_monitor_config->scale);
expected_mode_width *= logical_monitor_config->scale;
expected_mode_height *= logical_monitor_config->scale;
break;
case META_LOGICAL_MONITOR_LAYOUT_MODE_PHYSICAL:
break;
@@ -1295,14 +1024,12 @@ has_adjecent_neighbour (MetaMonitorsConfig *config,
gboolean
meta_verify_monitors_config (MetaMonitorsConfig *config,
MetaMonitorManager *monitor_manager,
GError **error)
{
int min_x, min_y;
gboolean has_primary;
GList *region;
GList *l;
gboolean global_scale_required;
if (!config->logical_monitor_configs)
{
@@ -1311,10 +1038,6 @@ meta_verify_monitors_config (MetaMonitorsConfig *config,
return FALSE;
}
global_scale_required =
!!(meta_monitor_manager_get_capabilities (monitor_manager) &
META_MONITOR_MANAGER_CAPABILITY_GLOBAL_SCALE_REQUIRED);
min_x = INT_MAX;
min_y = INT_MAX;
region = NULL;
@@ -1323,21 +1046,6 @@ meta_verify_monitors_config (MetaMonitorsConfig *config,
{
MetaLogicalMonitorConfig *logical_monitor_config = l->data;
if (global_scale_required)
{
MetaLogicalMonitorConfig *prev_logical_monitor_config =
l->prev ? l->prev->data : NULL;
if (prev_logical_monitor_config &&
(prev_logical_monitor_config->scale !=
logical_monitor_config->scale))
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Logical monitor scales must be identical");
return FALSE;
}
}
if (meta_rectangle_overlaps_with_region (region,
&logical_monitor_config->layout))
{

View File

@@ -41,7 +41,7 @@ typedef struct _MetaLogicalMonitorConfig
MetaRectangle layout;
GList *monitor_configs;
MetaMonitorTransform transform;
float scale;
int scale;
gboolean is_primary;
gboolean is_presentation;
} MetaLogicalMonitorConfig;
@@ -83,14 +83,6 @@ MetaMonitorsConfig * meta_monitor_config_manager_create_fallback (MetaMonitorCon
MetaMonitorsConfig * meta_monitor_config_manager_create_suggested (MetaMonitorConfigManager *config_manager);
MetaMonitorsConfig * meta_monitor_config_manager_create_for_orientation (MetaMonitorConfigManager *config_manager,
MetaMonitorTransform transform);
MetaMonitorsConfig * meta_monitor_config_manager_create_for_rotate_monitor (MetaMonitorConfigManager *config_manager);
MetaMonitorsConfig * meta_monitor_config_manager_create_for_switch_config (MetaMonitorConfigManager *config_manager,
MetaMonitorSwitchConfigType config_type);
void meta_monitor_config_manager_set_current (MetaMonitorConfigManager *config_manager,
MetaMonitorsConfig *config);
@@ -125,11 +117,9 @@ gboolean meta_verify_monitor_config (MetaMonitorConfig *monitor_config,
gboolean meta_verify_logical_monitor_config (MetaLogicalMonitorConfig *logical_monitor_config,
MetaLogicalMonitorLayoutMode layout_mode,
MetaMonitorManager *monitor_manager,
GError **error);
gboolean meta_verify_monitors_config (MetaMonitorsConfig *config,
MetaMonitorManager *monitor_manager,
GError **error);
#endif /* META_MONITOR_CONFIG_MANAGER_H */

View File

@@ -53,7 +53,6 @@
* <width>1920</width>
* <height>1080</height>
* <rate>60.049972534179688</rate>
* <flag>interlace</flag>
* </mode>
* </monitor>
* <transform>
@@ -136,7 +135,6 @@ typedef enum
STATE_MONITOR_MODE_WIDTH,
STATE_MONITOR_MODE_HEIGHT,
STATE_MONITOR_MODE_RATE,
STATE_MONITOR_MODE_FLAG,
STATE_MONITOR_UNDERSCANNING
} ParserState;
@@ -386,10 +384,6 @@ handle_start_element (GMarkupParseContext *context,
{
parser->state = STATE_MONITOR_MODE_RATE;
}
else if (g_str_equal (element_name, "flag"))
{
parser->state = STATE_MONITOR_MODE_FLAG;
}
else
{
g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_UNKNOWN_ELEMENT,
@@ -403,7 +397,6 @@ handle_start_element (GMarkupParseContext *context,
case STATE_MONITOR_MODE_WIDTH:
case STATE_MONITOR_MODE_HEIGHT:
case STATE_MONITOR_MODE_RATE:
case STATE_MONITOR_MODE_FLAG:
{
g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_UNKNOWN_ELEMENT,
"Invalid mode sub element '%s'", element_name);
@@ -460,8 +453,8 @@ derive_logical_monitor_layout (MetaLogicalMonitorConfig *logical_monitor_conf
switch (layout_mode)
{
case META_LOGICAL_MONITOR_LAYOUT_MODE_LOGICAL:
width = roundf (width / logical_monitor_config->scale);
height = roundf (height / logical_monitor_config->scale);
width /= logical_monitor_config->scale;
height /= logical_monitor_config->scale;
break;
case META_LOGICAL_MONITOR_LAYOUT_MODE_PHYSICAL:
break;
@@ -546,7 +539,6 @@ handle_end_element (GMarkupParseContext *context,
case STATE_MONITOR_MODE_WIDTH:
case STATE_MONITOR_MODE_HEIGHT:
case STATE_MONITOR_MODE_RATE:
case STATE_MONITOR_MODE_FLAG:
{
parser->state = STATE_MONITOR_MODE;
return;
@@ -638,7 +630,6 @@ handle_end_element (GMarkupParseContext *context,
if (!meta_verify_logical_monitor_config (logical_monitor_config,
layout_mode,
store->monitor_manager,
error))
return;
}
@@ -649,8 +640,7 @@ handle_end_element (GMarkupParseContext *context,
parser->current_logical_monitor_configs = NULL;
if (!meta_verify_monitors_config (config, store->monitor_manager,
error))
if (!meta_verify_monitors_config (config, error))
{
g_object_unref (config);
return;
@@ -837,14 +827,14 @@ handle_text (GMarkupParseContext *context,
case STATE_LOGICAL_MONITOR_SCALE:
{
if (!read_float (text, text_len,
&parser->current_logical_monitor_config->scale, error))
if (!read_int (text, text_len,
&parser->current_logical_monitor_config->scale, error))
return;
if (parser->current_logical_monitor_config->scale <= 0.0)
if (parser->current_logical_monitor_config->scale <= 0)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Logical monitor scale '%g' invalid",
"Logical monitor scale '%d' invalid",
parser->current_logical_monitor_config->scale);
return;
}
@@ -917,22 +907,6 @@ handle_text (GMarkupParseContext *context,
return;
}
case STATE_MONITOR_MODE_FLAG:
{
if (strncmp (text, "interlace", text_len) == 0)
{
parser->current_monitor_mode_spec->flags |=
META_CRTC_MODE_FLAG_INTERLACE;
}
else
{
g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
"Invalid mode flag %.*s", (int) text_len, text);
}
return;
}
case STATE_MONITOR_UNDERSCANNING:
{
read_bool (text, text_len,
@@ -1031,8 +1005,6 @@ append_monitors (GString *buffer,
monitor_config->mode_spec->height);
g_string_append_printf (buffer, " <rate>%s</rate>\n",
rate_str);
if (monitor_config->mode_spec->flags & META_CRTC_MODE_FLAG_INTERLACE)
g_string_append_printf (buffer, " <flag>interlace</flag>\n");
g_string_append (buffer, " </mode>\n");
if (monitor_config->enable_underscanning)
g_string_append (buffer, " <underscanning>yes</underscanning>\n");
@@ -1096,17 +1068,13 @@ static void
append_logical_monitor_xml (GString *buffer,
MetaLogicalMonitorConfig *logical_monitor_config)
{
char scale_str[G_ASCII_DTOSTR_BUF_SIZE];
g_string_append (buffer, " <logicalmonitor>\n");
g_string_append_printf (buffer, " <x>%d</x>\n",
logical_monitor_config->layout.x);
g_string_append_printf (buffer, " <y>%d</y>\n",
logical_monitor_config->layout.y);
g_ascii_dtostr (scale_str, G_ASCII_DTOSTR_BUF_SIZE,
logical_monitor_config->scale);
g_string_append_printf (buffer, " <scale>%s</scale>\n",
scale_str);
g_string_append_printf (buffer, " <scale>%d</scale>\n",
logical_monitor_config->scale);
if (logical_monitor_config->is_primary)
g_string_append (buffer, " <primary>yes</primary>\n");
if (logical_monitor_config->is_presentation)

View File

@@ -36,7 +36,6 @@
#include "boxes-private.h"
#include "meta-monitor-config.h"
#include "meta-backend-private.h"
#include <string.h>
#include <clutter/clutter.h>
@@ -143,28 +142,6 @@ config_new (void)
return config;
}
static MetaConfiguration *
config_copy (MetaConfiguration *config)
{
MetaConfiguration *new = config_new ();
guint i;
new->n_outputs = config->n_outputs;
new->keys = g_malloc (sizeof (MetaOutputKey) * config->n_outputs);
for (i = 0; i < config->n_outputs; i++)
{
new->keys[i].connector = g_strdup (config->keys[i].connector);
new->keys[i].vendor = g_strdup (config->keys[i].vendor);
new->keys[i].product = g_strdup (config->keys[i].product);
new->keys[i].serial = g_strdup (config->keys[i].serial);
}
new->outputs = g_memdup (config->outputs, sizeof (MetaOutputConfig) * config->n_outputs);
return new;
}
static unsigned long
output_key_hash (const MetaOutputKey *key)
{
@@ -1270,9 +1247,9 @@ make_linear_config (MetaMonitorConfig *self,
unsigned n_outputs,
int max_width,
int max_height,
MetaConfiguration *config,
unsigned long output_configured_bitmap)
MetaConfiguration *config)
{
unsigned long output_configured_bitmap = 0;
unsigned i;
int x;
int primary;
@@ -1409,7 +1386,7 @@ make_default_config (MetaMonitorConfig *self,
extend_stored_config (self, outputs, n_outputs, max_width, max_height, ret))
goto check_limits;
make_linear_config (self, outputs, n_outputs, max_width, max_height, ret, 0);
make_linear_config (self, outputs, n_outputs, max_width, max_height, ret);
check_limits:
/* Disable outputs that would go beyond framebuffer limits */
@@ -1621,255 +1598,6 @@ meta_monitor_config_lid_is_closed_changed (MetaMonitorConfig *self,
}
}
static void
do_builtin_display_rotation (MetaMonitorConfig *self,
gboolean rotate,
MetaMonitorTransform transform)
{
MetaBackend *backend = meta_get_backend ();
MetaMonitorManager *monitor_manager = meta_backend_get_monitor_manager (backend);
MetaConfiguration *new_config;
MetaOutputConfig *output_config;
guint i;
if (!self->current)
return;
if (multiple_outputs_are_enabled (self->current) ||
!laptop_display_is_on (self->current))
return;
new_config = config_copy (self->current);
output_config = NULL;
for (i = 0; i < new_config->n_outputs; i++)
if (new_config->outputs[i].enabled)
{
output_config = &new_config->outputs[i];
break;
}
g_assert (output_config);
if (rotate)
transform = (output_config->transform + 1) % META_MONITOR_TRANSFORM_FLIPPED;
if (output_config->transform != transform)
{
output_config->transform = transform;
apply_configuration (self, new_config, monitor_manager);
}
config_unref (new_config);
}
void
meta_monitor_config_orientation_changed (MetaMonitorConfig *self,
MetaMonitorTransform transform)
{
do_builtin_display_rotation (self, FALSE, transform);
}
void
meta_monitor_config_rotate_monitor (MetaMonitorConfig *self)
{
do_builtin_display_rotation (self, TRUE, META_MONITOR_TRANSFORM_NORMAL);
}
static MetaConfiguration *
make_all_mirror_config (MetaMonitorConfig *self,
MetaOutput *outputs,
guint n_outputs)
{
MetaConfiguration *config;
gint common_width = 0;
gint common_height = 0;
guint i, j, k;
if (n_outputs < 2)
return NULL;
for (i = 0; i < outputs[0].n_modes; i++)
{
gboolean common_mode_size = TRUE;
for (j = 1; j < n_outputs; j++)
{
gboolean have_same_mode_size = FALSE;
for (k = 0; k < outputs[j].n_modes; k++)
{
if (outputs[j].modes[k]->width == outputs[0].modes[i]->width &&
outputs[j].modes[k]->height == outputs[0].modes[i]->height)
{
have_same_mode_size = TRUE;
break;
}
}
if (!have_same_mode_size)
{
common_mode_size = FALSE;
break;
}
}
if (common_mode_size &&
common_width * common_height < outputs[0].modes[i]->width * outputs[0].modes[i]->height)
{
common_width = outputs[0].modes[i]->width;
common_height = outputs[0].modes[i]->height;
}
}
if (common_width == 0 || common_height == 0)
return NULL;
config = config_new ();
make_config_key (config, outputs, n_outputs, -1);
config->outputs = g_new0 (MetaOutputConfig, n_outputs);
for (i = 0; i < n_outputs; i++)
{
init_config_from_preferred_mode (&config->outputs[i], &outputs[i]);
config->outputs[i].rect.width = common_width;
config->outputs[i].rect.height = common_height;
config->outputs[i].is_primary = TRUE;
}
return config;
}
static MetaConfiguration *
make_all_linear_config (MetaMonitorConfig *self,
MetaOutput *outputs,
guint n_outputs,
gint max_width,
gint max_height)
{
MetaConfiguration *config;
config = config_new ();
make_config_key (config, outputs, n_outputs, -1);
config->outputs = g_new0 (MetaOutputConfig, n_outputs);
make_linear_config (self, outputs, n_outputs, max_width, max_height, config, 0);
return config;
}
static MetaConfiguration *
make_external_config (MetaMonitorConfig *self,
MetaOutput *outputs,
guint n_outputs,
gint max_width,
gint max_height)
{
MetaConfiguration *config;
gulong bitmap;
guint i;
config = config_new ();
make_config_key (config, outputs, n_outputs, -1);
config->outputs = g_new0 (MetaOutputConfig, n_outputs);
bitmap = 0;
for (i = 0; i < n_outputs; i++)
if (meta_output_is_laptop (&outputs[i]))
{
bitmap = 1 << i;
break;
}
make_linear_config (self, outputs, n_outputs, max_width, max_height, config, bitmap);
return config;
}
static MetaConfiguration *
make_builtin_config (MetaMonitorConfig *self,
MetaOutput *outputs,
guint n_outputs)
{
MetaConfiguration *config;
gboolean have_builtin = FALSE;
guint i;
config = config_new ();
make_config_key (config, outputs, n_outputs, -1);
config->outputs = g_new0 (MetaOutputConfig, n_outputs);
for (i = 0; i < n_outputs; i++)
{
if (meta_output_is_laptop (&outputs[i]))
{
init_config_from_preferred_mode (&config->outputs[i], &outputs[i]);
config->outputs[i].is_primary = TRUE;
have_builtin = TRUE;
}
else
{
config->outputs[i].enabled = FALSE;
}
}
if (have_builtin)
return config;
config_unref (config);
return NULL;
}
gboolean
meta_monitor_config_switch_config (MetaMonitorConfig *self,
MetaMonitorSwitchConfigType config_type)
{
MetaBackend *backend = meta_get_backend ();
MetaMonitorManager *monitor_manager = meta_backend_get_monitor_manager (backend);
MetaConfiguration *new_config = NULL;
MetaOutput *outputs;
gint max_width, max_height;
guint n_outputs;
gboolean success;
if (!meta_monitor_manager_can_switch_config (monitor_manager))
return FALSE;
outputs = meta_monitor_manager_get_outputs (monitor_manager, &n_outputs);
if (!meta_monitor_manager_get_max_screen_size (monitor_manager, &max_width, &max_height))
{
max_width = 65535;
max_height = 65535;
}
switch (config_type)
{
case META_MONITOR_SWITCH_CONFIG_ALL_MIRROR:
new_config = make_all_mirror_config (self, outputs, n_outputs);
break;
case META_MONITOR_SWITCH_CONFIG_ALL_LINEAR:
new_config = make_all_linear_config (self, outputs, n_outputs, max_width, max_height);
break;
case META_MONITOR_SWITCH_CONFIG_EXTERNAL:
new_config = make_external_config (self, outputs, n_outputs, max_width, max_height);
break;
case META_MONITOR_SWITCH_CONFIG_BUILTIN:
new_config = make_builtin_config (self, outputs, n_outputs);
break;
case META_MONITOR_SWITCH_CONFIG_UNKNOWN:
g_warn_if_reached ();
break;
}
if (!new_config)
return FALSE;
success = apply_configuration (self, new_config, monitor_manager);
config_unref (new_config);
return success;
}
typedef struct {
MetaMonitorConfig *config;
GString *buffer;

View File

@@ -49,12 +49,4 @@ gboolean meta_monitor_config_get_is_builtin_display_on (MetaMonitorCon
void meta_monitor_config_lid_is_closed_changed (MetaMonitorConfig *self,
MetaMonitorManager *manager);
void meta_monitor_config_orientation_changed (MetaMonitorConfig *self,
MetaMonitorTransform transform);
void meta_monitor_config_rotate_monitor (MetaMonitorConfig *self);
gboolean meta_monitor_config_switch_config (MetaMonitorConfig *self,
MetaMonitorSwitchConfigType config_type);
#endif /* META_MONITOR_CONFIG_H */

View File

@@ -31,7 +31,6 @@
#include <meta/util.h>
#include "backends/meta-backend-private.h"
#include "backends/meta-monitor.h"
#include "backends/meta-monitor-config-manager.h"
#define ALL_TRANSFORMS ((1 << (META_MONITOR_TRANSFORM_FLIPPED_270 + 1)) - 1)
@@ -41,6 +40,11 @@
#define MAX_CRTCS (MAX_MONITORS * 2)
#define MAX_MODES (MAX_MONITORS * 4)
static float supported_scales_dummy[] = {
1.0,
2.0
};
struct _MetaMonitorManagerDummy
{
MetaMonitorManager parent_instance;
@@ -55,7 +59,7 @@ struct _MetaMonitorManagerDummyClass
typedef struct _MetaOutputDummy
{
float scale;
int scale;
} MetaOutputDummy;
G_DEFINE_TYPE (MetaMonitorManagerDummy, meta_monitor_manager_dummy, META_TYPE_MONITOR_MANAGER);
@@ -70,7 +74,7 @@ static void
append_monitor (GArray *modes,
GArray *crtcs,
GArray *outputs,
float scale)
int scale)
{
MetaCrtcMode modes_decl[] = {
{
@@ -242,7 +246,7 @@ static void
meta_monitor_manager_dummy_read_current (MetaMonitorManager *manager)
{
unsigned int num_monitors = 1;
float *monitor_scales = NULL;
int *monitor_scales = NULL;
const char *num_monitors_str;
const char *monitor_scales_str;
const char *tiled_monitors_str;
@@ -294,9 +298,9 @@ meta_monitor_manager_dummy_read_current (MetaMonitorManager *manager)
}
}
monitor_scales = g_newa (typeof (*monitor_scales), num_monitors);
monitor_scales = g_newa (int, num_monitors);
for (i = 0; i < num_monitors; i++)
monitor_scales[i] = 1.0;
monitor_scales[i] = 1;
monitor_scales_str = getenv ("MUTTER_DEBUG_DUMMY_MONITOR_SCALES");
if (monitor_scales_str)
@@ -309,9 +313,11 @@ meta_monitor_manager_dummy_read_current (MetaMonitorManager *manager)
"of monitors (defaults to 1).\n");
for (i = 0; i < num_monitors && scales_str_list[i]; i++)
{
float scale = g_ascii_strtod (scales_str_list[i], NULL);
monitor_scales[i] = scale;
int scale = g_ascii_strtoll (scales_str_list[i], NULL, 10);
if (scale == 1 || scale == 2)
monitor_scales[i] = scale;
else
meta_warning ("Invalid dummy monitor scale");
}
g_strfreev (scales_str_list);
}
@@ -351,16 +357,9 @@ meta_monitor_manager_dummy_ensure_initial_config (MetaMonitorManager *manager)
config = meta_monitor_manager_ensure_configured (manager);
if (meta_is_monitor_config_manager_enabled ())
{
meta_monitor_manager_update_logical_state (manager, config);
}
meta_monitor_manager_update_logical_state (manager, config);
else
{
MetaMonitorManagerDeriveFlag flags =
META_MONITOR_MANAGER_DERIVE_FLAG_NONE;
meta_monitor_manager_update_logical_state_derived (manager, flags);
}
meta_monitor_manager_update_logical_state_derived (manager);
}
static void
@@ -566,14 +565,11 @@ meta_monitor_manager_dummy_apply_config (MetaMonitorManager *manager,
MetaOutputInfo **outputs,
unsigned int n_outputs)
{
MetaMonitorManagerDeriveFlag flags =
META_MONITOR_MANAGER_DERIVE_FLAG_NONE;
apply_crtc_assignments (manager, crtcs, n_crtcs, outputs, n_outputs);
legacy_calculate_screen_size (manager);
meta_monitor_manager_rebuild_derived (manager, flags);
meta_monitor_manager_rebuild_derived (manager);
}
static gboolean
@@ -586,7 +582,7 @@ meta_monitor_manager_dummy_is_transform_handled (MetaMonitorManager *manager,
return manager_dummy->is_transform_handled;
}
static float
static int
meta_monitor_manager_dummy_calculate_monitor_mode_scale (MetaMonitorManager *manager,
MetaMonitor *monitor,
MetaMonitorMode *monitor_mode)
@@ -600,53 +596,35 @@ meta_monitor_manager_dummy_calculate_monitor_mode_scale (MetaMonitorManager *man
return output_dummy->scale;
}
static float *
meta_monitor_manager_dummy_calculate_supported_scales (MetaMonitorManager *manager,
MetaLogicalMonitorLayoutMode layout_mode,
MetaMonitor *monitor,
MetaMonitorMode *monitor_mode,
int *n_supported_scales)
static void
meta_monitor_manager_dummy_get_supported_scales (MetaMonitorManager *manager,
float **scales,
int *n_scales)
{
MetaMonitorScalesConstraint constraints =
META_MONITOR_SCALES_CONSTRAINT_NONE;
switch (layout_mode)
{
case META_LOGICAL_MONITOR_LAYOUT_MODE_LOGICAL:
break;
case META_LOGICAL_MONITOR_LAYOUT_MODE_PHYSICAL:
constraints |= META_MONITOR_SCALES_CONSTRAINT_NO_FRAC;
break;
}
return meta_monitor_calculate_supported_scales (monitor, monitor_mode,
constraints,
n_supported_scales);
*scales = supported_scales_dummy;
*n_scales = G_N_ELEMENTS (supported_scales_dummy);
}
static gboolean
is_monitor_framebuffers_scaled (void)
{
MetaBackend *backend = meta_get_backend ();
MetaSettings *settings = meta_backend_get_settings (backend);
return meta_settings_is_experimental_feature_enabled (
settings,
return meta_backend_is_experimental_feature_enabled (
backend,
META_EXPERIMENTAL_FEATURE_SCALE_MONITOR_FRAMEBUFFER);
}
static MetaMonitorManagerCapability
meta_monitor_manager_dummy_get_capabilities (MetaMonitorManager *manager)
{
MetaBackend *backend = meta_get_backend ();
MetaSettings *settings = meta_backend_get_settings (backend);
MetaMonitorManagerCapability capabilities =
META_MONITOR_MANAGER_CAPABILITY_NONE;
capabilities |= META_MONITOR_MANAGER_CAPABILITY_MIRRORING;
if (meta_settings_is_experimental_feature_enabled (
settings,
if (meta_backend_is_experimental_feature_enabled (
meta_get_backend (),
META_EXPERIMENTAL_FEATURE_SCALE_MONITOR_FRAMEBUFFER))
capabilities |= META_MONITOR_MANAGER_CAPABILITY_LAYOUT_MODE;
@@ -690,7 +668,7 @@ meta_monitor_manager_dummy_class_init (MetaMonitorManagerDummyClass *klass)
manager_class->apply_configuration = meta_monitor_manager_dummy_apply_config;
manager_class->is_transform_handled = meta_monitor_manager_dummy_is_transform_handled;
manager_class->calculate_monitor_mode_scale = meta_monitor_manager_dummy_calculate_monitor_mode_scale;
manager_class->calculate_supported_scales = meta_monitor_manager_dummy_calculate_supported_scales;
manager_class->get_supported_scales = meta_monitor_manager_dummy_get_supported_scales;
manager_class->get_capabilities = meta_monitor_manager_dummy_get_capabilities;
manager_class->get_max_screen_size = meta_monitor_manager_dummy_get_max_screen_size;
manager_class->get_default_layout_mode = meta_monitor_manager_dummy_get_default_layout_mode;

View File

@@ -72,8 +72,7 @@ typedef enum _MetaMonitorManagerCapability
{
META_MONITOR_MANAGER_CAPABILITY_NONE = 0,
META_MONITOR_MANAGER_CAPABILITY_MIRRORING = (1 << 0),
META_MONITOR_MANAGER_CAPABILITY_LAYOUT_MODE = (1 << 1),
META_MONITOR_MANAGER_CAPABILITY_GLOBAL_SCALE_REQUIRED = (1 << 2)
META_MONITOR_MANAGER_CAPABILITY_LAYOUT_MODE = (1 << 1)
} MetaMonitorManagerCapability;
/* Equivalent to the 'method' enum in org.gnome.Mutter.DisplayConfig */
@@ -91,12 +90,6 @@ typedef enum _MetaLogicalMonitorLayoutMode
META_LOGICAL_MONITOR_LAYOUT_MODE_PHYSICAL = 2
} MetaLogicalMonitorLayoutMode;
typedef enum _MetaMonitorManagerDeriveFlag
{
META_MONITOR_MANAGER_DERIVE_FLAG_NONE = 0,
META_MONITOR_MANAGER_DERIVE_FLAG_CONFIGURED_SCALE = (1 << 0)
} MetaMonitorManagerDeriveFlag;
typedef enum
{
META_MONITOR_TRANSFORM_NORMAL,
@@ -131,28 +124,6 @@ typedef enum
META_CONNECTOR_TYPE_DSI = 16,
} MetaConnectorType;
/* Same as KMS mode flags and X11 randr flags */
typedef enum
{
META_CRTC_MODE_FLAG_NONE = 0,
META_CRTC_MODE_FLAG_PHSYNC = (1 << 0),
META_CRTC_MODE_FLAG_NHSYNC = (1 << 1),
META_CRTC_MODE_FLAG_PVSYNC = (1 << 2),
META_CRTC_MODE_FLAG_NVSYNC = (1 << 3),
META_CRTC_MODE_FLAG_INTERLACE = (1 << 4),
META_CRTC_MODE_FLAG_DBLSCAN = (1 << 5),
META_CRTC_MODE_FLAG_CSYNC = (1 << 6),
META_CRTC_MODE_FLAG_PCSYNC = (1 << 7),
META_CRTC_MODE_FLAG_NCSYNC = (1 << 8),
META_CRTC_MODE_FLAG_HSKEW = (1 << 9),
META_CRTC_MODE_FLAG_BCAST = (1 << 10),
META_CRTC_MODE_FLAG_PIXMUX = (1 << 11),
META_CRTC_MODE_FLAG_DBLCLK = (1 << 12),
META_CRTC_MODE_FLAG_CLKDIV2 = (1 << 13),
META_CRTC_MODE_FLAG_MASK = 0x3fff
} MetaCrtcModeFlag;
struct _MetaTileInfo
{
guint32 group_id;
@@ -253,7 +224,7 @@ struct _MetaCrtcMode
int width;
int height;
float refresh_rate;
MetaCrtcModeFlag flags;
guint32 flags;
gpointer driver_private;
GDestroyNotify driver_notify;
@@ -354,8 +325,6 @@ struct _MetaMonitorManager
UpClient *up_client;
gulong experimental_features_changed_handler_id;
MetaMonitorSwitchConfigType current_switch_config;
};
struct _MetaMonitorManagerClass
@@ -414,15 +383,13 @@ struct _MetaMonitorManagerClass
MetaCrtc *,
MetaMonitorTransform);
float (*calculate_monitor_mode_scale) (MetaMonitorManager *,
MetaMonitor *,
MetaMonitorMode *);
int (*calculate_monitor_mode_scale) (MetaMonitorManager *,
MetaMonitor *,
MetaMonitorMode *);
float * (*calculate_supported_scales) (MetaMonitorManager *,
MetaLogicalMonitorLayoutMode ,
MetaMonitor *,
MetaMonitorMode *,
int *);
void (*get_supported_scales) (MetaMonitorManager *,
float **,
int *);
MetaMonitorManagerCapability (*get_capabilities) (MetaMonitorManager *);
@@ -437,8 +404,7 @@ gboolean meta_is_monitor_config_manager_enabled (void);
void meta_monitor_manager_rebuild (MetaMonitorManager *manager,
MetaMonitorsConfig *config);
void meta_monitor_manager_rebuild_derived (MetaMonitorManager *manager,
MetaMonitorManagerDeriveFlag flags);
void meta_monitor_manager_rebuild_derived (MetaMonitorManager *manager);
int meta_monitor_manager_get_num_logical_monitors (MetaMonitorManager *manager);
@@ -521,8 +487,7 @@ MetaMonitorsConfig * meta_monitor_manager_ensure_configured (MetaMonitorManager
void meta_monitor_manager_update_logical_state (MetaMonitorManager *manager,
MetaMonitorsConfig *config);
void meta_monitor_manager_update_logical_state_derived (MetaMonitorManager *manager,
MetaMonitorManagerDeriveFlag flags);
void meta_monitor_manager_update_logical_state_derived (MetaMonitorManager *manager);
gboolean meta_monitor_manager_is_lid_closed (MetaMonitorManager *manager);
@@ -530,25 +495,10 @@ void meta_monitor_manager_lid_is_closed_changed (MetaMonitorManage
gboolean meta_monitor_manager_is_headless (MetaMonitorManager *manager);
float meta_monitor_manager_calculate_monitor_mode_scale (MetaMonitorManager *manager,
int meta_monitor_manager_calculate_monitor_mode_scale (MetaMonitorManager *manager,
MetaMonitor *monitor,
MetaMonitorMode *monitor_mode);
float * meta_monitor_manager_calculate_supported_scales (MetaMonitorManager *,
MetaLogicalMonitorLayoutMode ,
MetaMonitor *,
MetaMonitorMode *,
int *);
gboolean meta_monitor_manager_is_scale_supported (MetaMonitorManager *manager,
MetaLogicalMonitorLayoutMode layout_mode,
MetaMonitor *monitor,
MetaMonitorMode *monitor_mode,
float scale);
MetaMonitorManagerCapability
meta_monitor_manager_get_capabilities (MetaMonitorManager *manager);
gboolean meta_monitor_manager_get_max_screen_size (MetaMonitorManager *manager,
int *max_width,
int *max_height);
@@ -556,8 +506,6 @@ gboolean meta_monitor_manager_get_max_screen_size (MetaMonitorManager
MetaLogicalMonitorLayoutMode
meta_monitor_manager_get_default_layout_mode (MetaMonitorManager *manager);
void meta_monitor_manager_rotate_monitor (MetaMonitorManager *manager);
void meta_monitor_manager_clear_output (MetaOutput *output);
void meta_monitor_manager_clear_mode (MetaCrtcMode *mode);
void meta_monitor_manager_clear_crtc (MetaCrtc *crtc);

View File

@@ -40,7 +40,6 @@
#include "backends/meta-logical-monitor.h"
#include "backends/meta-monitor.h"
#include "backends/meta-monitor-config-manager.h"
#include "backends/meta-orientation-manager.h"
#include "backends/x11/meta-monitor-manager-xrandr.h"
#include "meta-backend-private.h"
@@ -78,11 +77,8 @@ meta_monitor_manager_init (MetaMonitorManager *manager)
gboolean
meta_is_monitor_config_manager_enabled (void)
{
MetaBackend *backend = meta_get_backend ();
MetaSettings *settings = meta_backend_get_settings (backend);
return meta_settings_is_experimental_feature_enabled (
settings,
return meta_backend_is_experimental_feature_enabled (
meta_get_backend (),
META_EXPERIMENTAL_FEATURE_MONITOR_CONFIG_MANAGER);
}
@@ -158,95 +154,43 @@ meta_monitor_manager_rebuild_logical_monitors (MetaMonitorManager *manager,
primary_logical_monitor);
}
static float
derive_configured_global_scale (MetaMonitorManager *manager)
static void
derive_monitor_layout (MetaMonitor *monitor,
MetaRectangle *layout)
{
MetaMonitorsConfig *config;
MetaLogicalMonitorConfig *logical_monitor_config;
config = meta_monitor_config_manager_get_current (manager->config_manager);
if (!config)
return 1.0;
logical_monitor_config = config->logical_monitor_configs->data;
return logical_monitor_config->scale;
}
static float
calculate_monitor_scale (MetaMonitorManager *manager,
MetaMonitor *monitor)
{
MetaMonitorMode *monitor_mode;
monitor_mode = meta_monitor_get_current_mode (monitor);
return meta_monitor_manager_calculate_monitor_mode_scale (manager,
monitor,
monitor_mode);
}
static float
derive_calculated_global_scale (MetaMonitorManager *manager)
{
MetaMonitor *primary_monitor;
primary_monitor = meta_monitor_manager_get_primary_monitor (manager);
if (!primary_monitor)
return 1.0;
return calculate_monitor_scale (manager, primary_monitor);
}
static float
derive_scale_from_config (MetaMonitorManager *manager,
MetaRectangle *layout)
{
MetaMonitorsConfig *config;
GList *outputs;
GList *l;
int x = INT_MAX;
int y = INT_MAX;
config = meta_monitor_config_manager_get_current (manager->config_manager);
for (l = config->logical_monitor_configs; l; l = l->next)
outputs = meta_monitor_get_outputs (monitor);
for (l = outputs; l; l = l->next)
{
MetaLogicalMonitorConfig *logical_monitor_config = l->data;
MetaOutput *output = l->data;
if (meta_rectangle_equal (layout, &logical_monitor_config->layout))
return logical_monitor_config->scale;
if (!output->crtc)
continue;
x = MIN (x, output->crtc->rect.x);
y = MIN (y, output->crtc->rect.y);
}
g_warning ("Missing logical monitor, using scale 1");
return 1.0;
layout->x = x;
layout->y = y;
meta_monitor_derive_dimensions (monitor, &layout->width, &layout->height);
}
static void
meta_monitor_manager_rebuild_logical_monitors_derived (MetaMonitorManager *manager,
MetaMonitorManagerDeriveFlag flags)
meta_monitor_manager_rebuild_logical_monitors_derived (MetaMonitorManager *manager)
{
GList *logical_monitors = NULL;
GList *l;
int monitor_number;
MetaLogicalMonitor *primary_logical_monitor = NULL;
gboolean use_configured_scale;
gboolean use_global_scale;
float global_scale = 0.0;
MetaMonitorManagerCapability capabilities;
monitor_number = 0;
capabilities = meta_monitor_manager_get_capabilities (manager);
use_global_scale =
!!(capabilities & META_MONITOR_MANAGER_CAPABILITY_GLOBAL_SCALE_REQUIRED);
use_configured_scale =
!!(flags & META_MONITOR_MANAGER_DERIVE_FLAG_CONFIGURED_SCALE);
if (use_global_scale)
{
if (use_configured_scale)
global_scale = derive_configured_global_scale (manager);
else
global_scale = derive_calculated_global_scale (manager);
}
for (l = manager->monitors; l; l = l->next)
{
MetaMonitor *monitor = l->data;
@@ -256,7 +200,7 @@ meta_monitor_manager_rebuild_logical_monitors_derived (MetaMonitorManager
if (!meta_monitor_is_active (monitor))
continue;
meta_monitor_derive_layout (monitor, &layout);
derive_monitor_layout (monitor, &layout);
logical_monitor = logical_monitor_from_layout (manager, logical_monitors,
&layout);
if (logical_monitor)
@@ -265,21 +209,9 @@ meta_monitor_manager_rebuild_logical_monitors_derived (MetaMonitorManager
}
else
{
float scale;
if (use_global_scale)
scale = global_scale;
else if (use_configured_scale)
scale = derive_scale_from_config (manager, &layout);
else
scale = calculate_monitor_scale (manager, monitor);
g_assert (scale > 0);
logical_monitor = meta_logical_monitor_new_derived (manager,
monitor,
&layout,
scale,
monitor_number);
logical_monitors = g_list_append (logical_monitors, logical_monitor);
monitor_number++;
@@ -349,9 +281,6 @@ lid_is_closed_changed (UpClient *client,
static gboolean
meta_monitor_manager_real_is_lid_closed (MetaMonitorManager *manager)
{
if (!manager->up_client)
return FALSE;
return up_client_get_lid_is_closed (manager->up_client);
}
@@ -367,7 +296,7 @@ meta_monitor_manager_is_headless (MetaMonitorManager *manager)
return !manager->monitors;
}
float
int
meta_monitor_manager_calculate_monitor_mode_scale (MetaMonitorManager *manager,
MetaMonitor *monitor,
MetaMonitorMode *monitor_mode)
@@ -380,24 +309,18 @@ meta_monitor_manager_calculate_monitor_mode_scale (MetaMonitorManager *manager,
monitor_mode);
}
float *
meta_monitor_manager_calculate_supported_scales (MetaMonitorManager *manager,
MetaLogicalMonitorLayoutMode layout_mode,
MetaMonitor *monitor,
MetaMonitorMode *monitor_mode,
int *n_supported_scales)
static void
meta_monitor_manager_get_supported_scales (MetaMonitorManager *manager,
float **scales,
int *n_scales)
{
MetaMonitorManagerClass *manager_class =
META_MONITOR_MANAGER_GET_CLASS (manager);
return manager_class->calculate_supported_scales (manager,
layout_mode,
monitor,
monitor_mode,
n_supported_scales);
manager_class->get_supported_scales (manager, scales, n_scales);
}
MetaMonitorManagerCapability
static MetaMonitorManagerCapability
meta_monitor_manager_get_capabilities (MetaMonitorManager *manager)
{
MetaMonitorManagerClass *manager_class =
@@ -445,15 +368,7 @@ meta_monitor_manager_apply_monitors_config (MetaMonitorManager *manager,
if (!manager_class->apply_monitors_config (manager, config, method, error))
return FALSE;
switch (method)
{
case META_MONITORS_CONFIG_METHOD_TEMPORARY:
case META_MONITORS_CONFIG_METHOD_PERSISTENT:
meta_monitor_config_manager_set_current (manager->config_manager, config);
break;
case META_MONITORS_CONFIG_METHOD_VERIFY:
break;
}
meta_monitor_config_manager_set_current (manager->config_manager, config);
return TRUE;
}
@@ -477,8 +392,7 @@ meta_monitor_manager_has_hotplug_mode_update (MetaMonitorManager *manager)
static gboolean
should_use_stored_config (MetaMonitorManager *manager)
{
return (manager->in_init ||
!meta_monitor_manager_has_hotplug_mode_update (manager));
return !meta_monitor_manager_has_hotplug_mode_update (manager);
}
static void
@@ -606,59 +520,7 @@ done:
}
static void
orientation_changed (MetaOrientationManager *orientation_manager,
MetaMonitorManager *manager)
{
MetaMonitorTransform transform;
switch (meta_orientation_manager_get_orientation (orientation_manager))
{
case META_ORIENTATION_NORMAL:
transform = META_MONITOR_TRANSFORM_NORMAL;
break;
case META_ORIENTATION_BOTTOM_UP:
transform = META_MONITOR_TRANSFORM_180;
break;
case META_ORIENTATION_LEFT_UP:
transform = META_MONITOR_TRANSFORM_90;
break;
case META_ORIENTATION_RIGHT_UP:
transform = META_MONITOR_TRANSFORM_270;
break;
case META_ORIENTATION_UNDEFINED:
default:
return;
}
if (!meta_is_monitor_config_manager_enabled ())
{
meta_monitor_config_orientation_changed (manager->legacy_config, transform);
}
else
{
GError *error = NULL;
MetaMonitorsConfig *config =
meta_monitor_config_manager_create_for_orientation (manager->config_manager,
transform);
if (!config)
return;
if (!meta_monitor_manager_apply_monitors_config (manager,
config,
META_MONITORS_CONFIG_METHOD_TEMPORARY,
&error))
{
g_warning ("Failed to use orientation monitor configuration: %s",
error->message);
g_error_free (error);
}
g_object_unref (config);
}
}
static void
experimental_features_changed (MetaSettings *settings,
experimental_features_changed (MetaBackend *backend,
MetaExperimentalFeature old_experimental_features,
MetaMonitorManager *manager)
{
@@ -668,6 +530,7 @@ experimental_features_changed (MetaSettings *settings,
gboolean is_config_manager_enabled;
gboolean is_stage_views_scaled;
gboolean should_reconfigure = FALSE;
int ui_scaling_factor;
is_config_manager_enabled = meta_is_monitor_config_manager_enabled ();
was_config_manager_enabled =
@@ -681,18 +544,21 @@ experimental_features_changed (MetaSettings *settings,
!!(old_experimental_features &
META_EXPERIMENTAL_FEATURE_SCALE_MONITOR_FRAMEBUFFER);
is_stage_views_scaled =
meta_settings_is_experimental_feature_enabled (
settings,
meta_backend_is_experimental_feature_enabled (
backend,
META_EXPERIMENTAL_FEATURE_SCALE_MONITOR_FRAMEBUFFER);
if (is_config_manager_enabled != was_config_manager_enabled ||
is_stage_views_scaled != was_stage_views_scaled)
should_reconfigure = TRUE;
ui_scaling_factor = meta_backend_get_ui_scaling_factor (backend);
if (should_reconfigure)
meta_monitor_manager_on_hotplug (manager);
meta_settings_update_ui_scaling_factor (settings);
if (ui_scaling_factor != meta_backend_get_ui_scaling_factor (backend))
meta_backend_notify_ui_scaling_factor_changed (backend);
}
static void
@@ -702,11 +568,9 @@ meta_monitor_manager_constructed (GObject *object)
MetaDBusDisplayConfig *skeleton = META_DBUS_DISPLAY_CONFIG (manager);
MetaMonitorManagerClass *manager_class =
META_MONITOR_MANAGER_GET_CLASS (manager);
MetaBackend *backend = meta_get_backend ();
MetaSettings *settings = meta_backend_get_settings (backend);
manager->experimental_features_changed_handler_id =
g_signal_connect (settings,
g_signal_connect (meta_get_backend (),
"experimental-features-changed",
G_CALLBACK (experimental_features_changed),
manager);
@@ -725,12 +589,6 @@ meta_monitor_manager_constructed (GObject *object)
skeleton,
meta_is_monitor_config_manager_enabled ());
g_signal_connect_object (meta_backend_get_orientation_manager (backend),
"orientation-changed",
G_CALLBACK (orientation_changed),
manager, 0);
manager->current_switch_config = META_MONITOR_SWITCH_CONFIG_UNKNOWN;
manager->in_init = TRUE;
/*
@@ -1532,7 +1390,7 @@ meta_monitor_manager_legacy_handle_apply_configuration (MetaDBusDisplayConfig *
#define META_DISPLAY_CONFIG_MODE_FLAGS_PREFERRED (1 << 0)
#define META_DISPLAY_CONFIG_MODE_FLAGS_CURRENT (1 << 1)
#define MODE_FORMAT "(siiddada{sv})"
#define MODE_FORMAT "(iiddu)"
#define MODES_FORMAT "a" MODE_FORMAT
#define MONITOR_SPEC_FORMAT "(ssss)"
#define MONITOR_FORMAT "(" MONITOR_SPEC_FORMAT MODES_FORMAT "a{sv})"
@@ -1549,8 +1407,11 @@ meta_monitor_manager_handle_get_current_state (MetaDBusDisplayConfig *skeleton,
MetaMonitorManager *manager = META_MONITOR_MANAGER (skeleton);
GVariantBuilder monitors_builder;
GVariantBuilder logical_monitors_builder;
GVariantBuilder supported_scales_builder;
GVariantBuilder properties_builder;
GList *l;
float *supported_scales;
int n_supported_scales;
int i;
MetaMonitorManagerCapability capabilities;
int max_screen_width, max_screen_height;
@@ -1588,64 +1449,26 @@ meta_monitor_manager_handle_get_current_state (MetaDBusDisplayConfig *skeleton,
for (k = meta_monitor_get_modes (monitor); k; k = k->next)
{
MetaMonitorMode *monitor_mode = k->data;
GVariantBuilder supported_scales_builder;
const char *mode_id;
int mode_width, mode_height;
float refresh_rate;
float preferred_scale;
float *supported_scales;
int n_supported_scales;
GVariantBuilder mode_properties_builder;
MetaCrtcModeFlag mode_flags;
mode_id = meta_monitor_mode_get_id (monitor_mode);
meta_monitor_mode_get_resolution (monitor_mode,
&mode_width, &mode_height);
refresh_rate = meta_monitor_mode_get_refresh_rate (monitor_mode);
MetaMonitorModeSpec *monitor_mode_spec;
int preferred_scale;
uint32_t flags = 0;
monitor_mode_spec = meta_monitor_mode_get_spec (monitor_mode);
preferred_scale =
meta_monitor_manager_calculate_monitor_mode_scale (manager,
monitor,
monitor_mode);
g_variant_builder_init (&supported_scales_builder,
G_VARIANT_TYPE ("ad"));
supported_scales =
meta_monitor_manager_calculate_supported_scales (manager,
manager->layout_mode,
monitor,
monitor_mode,
&n_supported_scales);
for (i = 0; i < n_supported_scales; i++)
g_variant_builder_add (&supported_scales_builder, "d",
(double) supported_scales[i]);
g_free (supported_scales);
mode_flags = meta_monitor_mode_get_flags (monitor_mode);
g_variant_builder_init (&mode_properties_builder,
G_VARIANT_TYPE ("a{sv}"));
if (monitor_mode == current_mode)
g_variant_builder_add (&mode_properties_builder, "{sv}",
"is-current",
g_variant_new_boolean (TRUE));
flags |= META_DISPLAY_CONFIG_MODE_FLAGS_CURRENT;
if (monitor_mode == preferred_mode)
g_variant_builder_add (&mode_properties_builder, "{sv}",
"is-preferred",
g_variant_new_boolean (TRUE));
if (mode_flags & META_CRTC_MODE_FLAG_INTERLACE)
g_variant_builder_add (&mode_properties_builder, "{sv}",
"is-interlaced",
g_variant_new_boolean (TRUE));
flags |= META_DISPLAY_CONFIG_MODE_FLAGS_PREFERRED;
g_variant_builder_add (&modes_builder, MODE_FORMAT,
mode_id,
mode_width,
mode_height,
refresh_rate,
monitor_mode_spec->width,
monitor_mode_spec->height,
monitor_mode_spec->refresh_rate,
(double) preferred_scale,
&supported_scales_builder,
&mode_properties_builder);
flags);
}
g_variant_builder_init (&monitor_properties_builder,
@@ -1712,6 +1535,13 @@ meta_monitor_manager_handle_get_current_state (MetaDBusDisplayConfig *skeleton,
NULL);
}
g_variant_builder_init (&supported_scales_builder, G_VARIANT_TYPE ("ad"));
meta_monitor_manager_get_supported_scales (manager,
&supported_scales,
&n_supported_scales);
for (i = 0; i < n_supported_scales; i++)
g_variant_builder_add (&supported_scales_builder, "d", supported_scales[i]);
g_variant_builder_init (&properties_builder, G_VARIANT_TYPE ("a{sv}"));
capabilities = meta_monitor_manager_get_capabilities (manager);
if ((capabilities & META_MONITOR_MANAGER_CAPABILITY_MIRRORING) == 0)
@@ -1731,13 +1561,6 @@ meta_monitor_manager_handle_get_current_state (MetaDBusDisplayConfig *skeleton,
g_variant_new_boolean (TRUE));
}
if (capabilities & META_MONITOR_MANAGER_CAPABILITY_GLOBAL_SCALE_REQUIRED)
{
g_variant_builder_add (&properties_builder, "{sv}",
"global-scale-required",
g_variant_new_boolean (TRUE));
}
if (meta_monitor_manager_get_max_screen_size (manager,
&max_screen_width,
&max_screen_height))
@@ -1762,6 +1585,7 @@ meta_monitor_manager_handle_get_current_state (MetaDBusDisplayConfig *skeleton,
manager->serial,
g_variant_builder_end (&monitors_builder),
g_variant_builder_end (&logical_monitors_builder),
g_variant_builder_end (&supported_scales_builder),
g_variant_builder_end (&properties_builder));
return TRUE;
@@ -1776,23 +1600,17 @@ meta_monitor_manager_handle_get_current_state (MetaDBusDisplayConfig *skeleton,
#undef LOGICAL_MONITOR_FORMAT
#undef LOGICAL_MONITORS_FORMAT
gboolean
meta_monitor_manager_is_scale_supported (MetaMonitorManager *manager,
MetaLogicalMonitorLayoutMode layout_mode,
MetaMonitor *monitor,
MetaMonitorMode *monitor_mode,
float scale)
static gboolean
meta_monitor_manager_is_scale_supported (MetaMonitorManager *manager,
float scale)
{
g_autofree float *supported_scales = NULL;
float *supported_scales;
int n_supported_scales;
int i;
supported_scales =
meta_monitor_manager_calculate_supported_scales (manager,
layout_mode,
monitor,
monitor_mode,
&n_supported_scales);
meta_monitor_manager_get_supported_scales (manager,
&supported_scales,
&n_supported_scales);
for (i = 0; i < n_supported_scales; i++)
{
if (supported_scales[i] == scale)
@@ -1815,6 +1633,13 @@ meta_monitor_manager_is_config_applicable (MetaMonitorManager *manager,
float scale = logical_monitor_config->scale;
GList *k;
if (!meta_monitor_manager_is_scale_supported (manager, scale))
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Scale not supported by backend");
return FALSE;
}
for (k = logical_monitor_config->monitor_configs; k; k = k->next)
{
MetaMonitorConfig *monitor_config = k->data;
@@ -1839,34 +1664,19 @@ meta_monitor_manager_is_config_applicable (MetaMonitorManager *manager,
"Specified monitor mode not available");
return FALSE;
}
if (!meta_monitor_manager_is_scale_supported (manager,
config->layout_mode,
monitor,
monitor_mode,
scale))
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Scale not supported by backend");
return FALSE;
}
}
}
return TRUE;
}
static MetaMonitor *
find_monitor_from_connector (MetaMonitorManager *manager,
char *connector)
static MetaMonitorSpec *
find_monitor_spec (MetaMonitorManager *manager,
char *connector)
{
GList *monitors;
GList *l;
if (!connector)
return NULL;
monitors = meta_monitor_manager_get_monitors (manager);
for (l = monitors; l; l = l->next)
{
@@ -1874,13 +1684,14 @@ find_monitor_from_connector (MetaMonitorManager *manager,
MetaMonitorSpec *monitor_spec = meta_monitor_get_spec (monitor);
if (g_str_equal (connector, monitor_spec->connector))
return monitor;
return meta_monitor_spec_clone (monitor_spec);
}
return NULL;
}
#define MONITOR_CONFIG_FORMAT "(ssa{sv})"
#define MONITOR_MODE_SPEC_FORMAT "(iid)"
#define MONITOR_CONFIG_FORMAT "(s" MONITOR_MODE_SPEC_FORMAT "a{sv})"
#define MONITOR_CONFIGS_FORMAT "a" MONITOR_CONFIG_FORMAT
#define LOGICAL_MONITOR_CONFIG_FORMAT "(iidub" MONITOR_CONFIGS_FORMAT ")"
@@ -1892,43 +1703,49 @@ create_monitor_config_from_variant (MetaMonitorManager *manager,
{
MetaMonitorConfig *monitor_config = NULL;
g_autofree char *connector = NULL;
g_autofree char *mode_id = NULL;
MetaMonitorMode *monitor_mode;
MetaMonitor *monitor;
char *connector;
MetaMonitorSpec *monitor_spec;
MetaMonitorModeSpec *monitor_mode_spec;
g_autoptr (GVariant) properties_variant = NULL;
GVariant *properties_variant = NULL;
gboolean enable_underscanning = FALSE;
int32_t mode_width;
int32_t mode_height;
double mode_refresh_rate;
g_variant_get (monitor_config_variant, "(ss@a{sv})",
monitor_spec = g_new0 (MetaMonitorSpec, 1);
monitor_mode_spec = g_new0 (MetaMonitorModeSpec, 1);
g_variant_get (monitor_config_variant, "(s" MONITOR_MODE_SPEC_FORMAT "@a{sv})",
&connector,
&mode_id,
&mode_width,
&mode_height,
&mode_refresh_rate,
&properties_variant);
monitor = find_monitor_from_connector (manager, connector);
if (!monitor)
*monitor_mode_spec = (MetaMonitorModeSpec) {
.width = mode_width,
.height = mode_height,
.refresh_rate = mode_refresh_rate
};
monitor_spec = find_monitor_spec (manager, connector);
if (!monitor_spec)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Invalid connector '%s' specified", connector);
g_free (monitor_mode_spec);
return NULL;
}
monitor_mode = meta_monitor_get_mode_from_id (monitor, mode_id);
if (!monitor_mode)
if (!meta_verify_monitor_mode_spec (monitor_mode_spec, error))
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Invalid mode '%s' specified", mode_id);
g_free (monitor_mode_spec);
meta_monitor_spec_free (monitor_spec);
return NULL;
}
g_variant_lookup (properties_variant, "underscanning", "b", &enable_underscanning);
monitor_spec = meta_monitor_spec_clone (meta_monitor_get_spec (monitor));
monitor_mode_spec = g_new0 (MetaMonitorModeSpec, 1);
*monitor_mode_spec = *meta_monitor_mode_get_spec (monitor_mode);
monitor_config = g_new0 (MetaMonitorConfig, 1);
*monitor_config = (MetaMonitorConfig) {
.monitor_spec = monitor_spec,
@@ -1940,76 +1757,26 @@ create_monitor_config_from_variant (MetaMonitorManager *manager,
}
static gboolean
find_monitor_mode_scale (MetaMonitorManager *manager,
MetaLogicalMonitorLayoutMode layout_mode,
MetaMonitorConfig *monitor_config,
float scale,
float *out_scale,
GError **error)
{
MetaMonitorSpec *monitor_spec;
MetaMonitor *monitor;
MetaMonitorModeSpec *monitor_mode_spec;
MetaMonitorMode *monitor_mode;
g_autofree float *supported_scales = NULL;
int n_supported_scales;
int i;
monitor_spec = monitor_config->monitor_spec;
monitor = meta_monitor_manager_get_monitor_from_spec (manager,
monitor_spec);
if (!monitor)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Monitor not found");
return FALSE;
}
monitor_mode_spec = monitor_config->mode_spec;
monitor_mode = meta_monitor_get_mode_from_spec (monitor,
monitor_mode_spec);
if (!monitor_mode)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Monitor mode not found");
return FALSE;
}
supported_scales =
meta_monitor_manager_calculate_supported_scales (manager, layout_mode,
monitor, monitor_mode,
&n_supported_scales);
for (i = 0; i < n_supported_scales; i++)
{
float supported_scale = supported_scales[i];
if (fabsf (supported_scale - scale) < FLT_EPSILON)
{
*out_scale = supported_scale;
return TRUE;
}
}
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Scale %g not valid for resolution %dx%d",
scale,
monitor_mode_spec->width,
monitor_mode_spec->height);
return FALSE;
}
static gboolean
derive_logical_monitor_size (MetaMonitorConfig *monitor_config,
derive_logical_monitor_size (GList *monitor_configs,
int *out_width,
int *out_height,
float scale,
double scale,
MetaMonitorTransform transform,
MetaLogicalMonitorLayoutMode layout_mode,
GError **error)
{
MetaMonitorConfig *monitor_config;
int width, height;
if (!monitor_configs)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Empty logical monitor");
return FALSE;
}
monitor_config = monitor_configs->data;
if (meta_monitor_transform_is_rotated (transform))
{
width = monitor_config->mode_spec->height;
@@ -2024,8 +1791,8 @@ derive_logical_monitor_size (MetaMonitorConfig *monitor_config,
switch (layout_mode)
{
case META_LOGICAL_MONITOR_LAYOUT_MODE_LOGICAL:
width = roundf (width / scale);
height = roundf (height / scale);
width /= scale;
height /= scale;
break;
case META_LOGICAL_MONITOR_LAYOUT_MODE_PHYSICAL:
break;
@@ -2045,22 +1812,19 @@ create_logical_monitor_config_from_variant (MetaMonitorManager *manager
{
MetaLogicalMonitorConfig *logical_monitor_config;
int x, y, width, height;
double scale_d;
float scale;
double scale;
MetaMonitorTransform transform;
gboolean is_primary;
GVariantIter *monitor_configs_iter;
GList *monitor_configs = NULL;
MetaMonitorConfig *monitor_config;
g_variant_get (logical_monitor_config_variant, LOGICAL_MONITOR_CONFIG_FORMAT,
&x,
&y,
&scale_d,
&scale,
&transform,
&is_primary,
&monitor_configs_iter);
scale = (float) scale_d;
while (TRUE)
{
@@ -2087,23 +1851,7 @@ create_logical_monitor_config_from_variant (MetaMonitorManager *manager
}
g_variant_iter_free (monitor_configs_iter);
if (!monitor_configs)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Empty logical monitor");
goto err;
}
monitor_config = monitor_configs->data;
if (!find_monitor_mode_scale (manager,
layout_mode,
monitor_config,
scale,
&scale,
error))
goto err;
if (!derive_logical_monitor_size (monitor_config, &width, &height,
if (!derive_logical_monitor_size (monitor_configs, &width, &height,
scale, transform, layout_mode, error))
goto err;
@@ -2116,14 +1864,13 @@ create_logical_monitor_config_from_variant (MetaMonitorManager *manager
.height = height
},
.transform = transform,
.scale = scale,
.scale = (int) scale,
.is_primary = is_primary,
.monitor_configs = monitor_configs
};
if (!meta_verify_logical_monitor_config (logical_monitor_config,
layout_mode,
manager,
error))
{
meta_logical_monitor_config_free (logical_monitor_config);
@@ -2248,7 +1995,7 @@ meta_monitor_manager_handle_apply_monitors_config (MetaDBusDisplayConfig *skelet
}
config = meta_monitors_config_new (logical_monitor_configs, layout_mode);
if (!meta_verify_monitors_config (config, manager, &error))
if (!meta_verify_monitors_config (config, &error))
{
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
G_DBUS_ERROR_INVALID_ARGS,
@@ -2811,7 +2558,7 @@ rebuild_monitors (MetaMonitorManager *manager)
{
MetaMonitorNormal *monitor_normal;
monitor_normal = meta_monitor_normal_new (manager, output);
monitor_normal = meta_monitor_normal_new (output);
manager->monitors = g_list_append (manager->monitors,
monitor_normal);
}
@@ -2884,8 +2631,6 @@ meta_monitor_manager_notify_monitors_changed (MetaMonitorManager *manager)
{
MetaBackend *backend = meta_get_backend ();
manager->current_switch_config = META_MONITOR_SWITCH_CONFIG_UNKNOWN;
meta_backend_monitors_changed (backend);
g_signal_emit_by_name (manager, "monitors-changed");
}
@@ -2982,17 +2727,15 @@ meta_monitor_manager_update_monitor_modes_derived (MetaMonitorManager *manager)
}
void
meta_monitor_manager_update_logical_state_derived (MetaMonitorManager *manager,
MetaMonitorManagerDeriveFlag flags)
meta_monitor_manager_update_logical_state_derived (MetaMonitorManager *manager)
{
manager->layout_mode = META_LOGICAL_MONITOR_LAYOUT_MODE_PHYSICAL;
meta_monitor_manager_rebuild_logical_monitors_derived (manager, flags);
meta_monitor_manager_rebuild_logical_monitors_derived (manager);
}
void
meta_monitor_manager_rebuild_derived (MetaMonitorManager *manager,
MetaMonitorManagerDeriveFlag flags)
meta_monitor_manager_rebuild_derived (MetaMonitorManager *manager)
{
GList *old_logical_monitors;
@@ -3003,7 +2746,7 @@ meta_monitor_manager_rebuild_derived (MetaMonitorManager *manager,
old_logical_monitors = manager->logical_monitors;
meta_monitor_manager_update_logical_state_derived (manager, flags);
meta_monitor_manager_update_logical_state_derived (manager);
meta_monitor_manager_notify_monitors_changed (manager);
@@ -3232,82 +2975,3 @@ meta_monitor_manager_get_is_builtin_display_on (MetaMonitorManager *manager)
return meta_monitor_is_active (laptop_panel);
}
void
meta_monitor_manager_rotate_monitor (MetaMonitorManager *manager)
{
if (!meta_is_monitor_config_manager_enabled ())
{
meta_monitor_config_rotate_monitor (manager->legacy_config);
}
else
{
GError *error = NULL;
MetaMonitorsConfig *config =
meta_monitor_config_manager_create_for_rotate_monitor (manager->config_manager);
if (!config)
return;
if (!meta_monitor_manager_apply_monitors_config (manager,
config,
META_MONITORS_CONFIG_METHOD_TEMPORARY,
&error))
{
g_warning ("Failed to use rotate monitor configuration: %s",
error->message);
g_error_free (error);
}
g_object_unref (config);
}
}
void
meta_monitor_manager_switch_config (MetaMonitorManager *manager,
MetaMonitorSwitchConfigType config_type)
{
g_return_if_fail (config_type != META_MONITOR_SWITCH_CONFIG_UNKNOWN);
if (!meta_is_monitor_config_manager_enabled ())
{
if (meta_monitor_config_switch_config (manager->legacy_config, config_type))
manager->current_switch_config = config_type;
}
else
{
GError *error = NULL;
MetaMonitorsConfig *config =
meta_monitor_config_manager_create_for_switch_config (manager->config_manager,
config_type);
if (!config)
return;
if (!meta_monitor_manager_apply_monitors_config (manager,
config,
META_MONITORS_CONFIG_METHOD_TEMPORARY,
&error))
{
g_warning ("Failed to use switch monitor configuration: %s",
error->message);
g_error_free (error);
}
else
{
manager->current_switch_config = config_type;
}
g_object_unref (config);
}
}
gboolean
meta_monitor_manager_can_switch_config (MetaMonitorManager *manager)
{
return (!meta_monitor_manager_is_lid_closed (manager) &&
g_list_length (manager->monitors) > 1);
}
MetaMonitorSwitchConfigType
meta_monitor_manager_get_switch_config (MetaMonitorManager *manager)
{
return manager->current_switch_config;
}

View File

@@ -25,17 +25,9 @@
#include "backends/meta-backend-private.h"
#include "backends/meta-monitor-manager-private.h"
#include "backends/meta-settings-private.h"
#define SCALE_FACTORS_PER_INTEGER 8
#define MINIMUM_SCALE_FACTOR 0.5f
#define MAXIMUM_SCALE_FACTOR 4.0f
#define HANDLED_CRTC_MODE_FLAGS (META_CRTC_MODE_FLAG_INTERLACE)
typedef struct _MetaMonitorMode
{
char *id;
MetaMonitorModeSpec spec;
MetaMonitorCrtcMode *crtc_modes;
} MetaMonitorMode;
@@ -49,11 +41,8 @@ typedef struct _MetaMonitorModeTiled
typedef struct _MetaMonitorPrivate
{
MetaMonitorManager *monitor_manager;
GList *outputs;
GList *modes;
GHashTable *mode_ids;
MetaMonitorMode *preferred_mode;
MetaMonitorMode *current_mode;
@@ -87,10 +76,6 @@ struct _MetaMonitorTiled
uint32_t tile_group_id;
/* The tile (0, 0) output. */
MetaOutput *origin_output;
/* The output enabled even when a non-tiled mode is used. */
MetaOutput *main_output;
};
@@ -157,7 +142,7 @@ meta_monitor_spec_free (MetaMonitorSpec *monitor_spec)
}
static void
meta_monitor_generate_spec (MetaMonitor *monitor)
meta_monitor_generate_id (MetaMonitor *monitor)
{
MetaMonitorPrivate *priv = meta_monitor_get_instance_private (monitor);
MetaOutput *output = meta_monitor_get_main_output (monitor);
@@ -258,10 +243,11 @@ meta_monitor_get_current_resolution (MetaMonitor *monitor,
}
void
meta_monitor_derive_layout (MetaMonitor *monitor,
MetaRectangle *layout)
meta_monitor_derive_dimensions (MetaMonitor *monitor,
int *width,
int *height)
{
META_MONITOR_GET_CLASS (monitor)->derive_layout (monitor, layout);
META_MONITOR_GET_CLASS (monitor)->derive_dimensions (monitor, width, height);
}
void
@@ -336,7 +322,6 @@ meta_monitor_finalize (GObject *object)
MetaMonitor *monitor = META_MONITOR (object);
MetaMonitorPrivate *priv = meta_monitor_get_instance_private (monitor);
g_hash_table_destroy (priv->mode_ids);
g_list_free_full (priv->modes, (GDestroyNotify) meta_monitor_mode_free);
g_clear_pointer (&priv->outputs, g_list_free);
meta_monitor_spec_free (priv->spec);
@@ -345,9 +330,6 @@ meta_monitor_finalize (GObject *object)
static void
meta_monitor_init (MetaMonitor *monitor)
{
MetaMonitorPrivate *priv = meta_monitor_get_instance_private (monitor);
priv->mode_ids = g_hash_table_new (g_str_hash, g_str_equal);
}
static void
@@ -358,39 +340,6 @@ meta_monitor_class_init (MetaMonitorClass *klass)
object_class->finalize = meta_monitor_finalize;
}
static char *
generate_mode_id (MetaMonitorModeSpec *monitor_mode_spec)
{
gboolean is_interlaced;
char refresh_rate_str[G_ASCII_DTOSTR_BUF_SIZE];
is_interlaced = !!(monitor_mode_spec->flags & META_CRTC_MODE_FLAG_INTERLACE);
g_ascii_dtostr (refresh_rate_str, G_ASCII_DTOSTR_BUF_SIZE,
monitor_mode_spec->refresh_rate);
return g_strdup_printf ("%dx%d%s@%s",
monitor_mode_spec->width,
monitor_mode_spec->height,
is_interlaced ? "i" : "",
refresh_rate_str);
}
static gboolean
meta_monitor_add_mode (MetaMonitor *monitor,
MetaMonitorMode *monitor_mode)
{
MetaMonitorPrivate *priv = meta_monitor_get_instance_private (monitor);
if (g_hash_table_lookup (priv->mode_ids,
meta_monitor_mode_get_id (monitor_mode)))
return FALSE;
priv->modes = g_list_append (priv->modes, monitor_mode);
g_hash_table_insert (priv->mode_ids, monitor_mode->id, monitor_mode);
return TRUE;
}
static void
meta_monitor_normal_generate_modes (MetaMonitorNormal *monitor_normal)
{
@@ -410,10 +359,8 @@ meta_monitor_normal_generate_modes (MetaMonitorNormal *monitor_normal)
mode->spec = (MetaMonitorModeSpec) {
.width = crtc_mode->width,
.height = crtc_mode->height,
.refresh_rate = crtc_mode->refresh_rate,
.flags = crtc_mode->flags & HANDLED_CRTC_MODE_FLAGS
.refresh_rate = crtc_mode->refresh_rate
},
mode->id = generate_mode_id (&mode->spec);
mode->crtc_modes = g_new (MetaMonitorCrtcMode, 1);
mode->crtc_modes[0] = (MetaMonitorCrtcMode) {
.output = output,
@@ -425,14 +372,12 @@ meta_monitor_normal_generate_modes (MetaMonitorNormal *monitor_normal)
if (output->crtc && crtc_mode == output->crtc->current_mode)
monitor_priv->current_mode = mode;
if (!meta_monitor_add_mode (monitor, mode))
meta_monitor_mode_free (mode);
monitor_priv->modes = g_list_append (monitor_priv->modes, mode);
}
}
MetaMonitorNormal *
meta_monitor_normal_new (MetaMonitorManager *monitor_manager,
MetaOutput *output)
meta_monitor_normal_new (MetaOutput *output)
{
MetaMonitorNormal *monitor_normal;
MetaMonitor *monitor;
@@ -442,13 +387,11 @@ meta_monitor_normal_new (MetaMonitorManager *monitor_manager,
monitor = META_MONITOR (monitor_normal);
monitor_priv = meta_monitor_get_instance_private (monitor);
monitor_priv->monitor_manager = monitor_manager;
monitor_priv->outputs = g_list_append (NULL, output);
monitor_priv->winsys_id = output->winsys_id;
meta_monitor_generate_spec (monitor);
meta_monitor_normal_generate_modes (monitor_normal);
meta_monitor_generate_id (monitor);
return monitor_normal;
}
@@ -463,35 +406,15 @@ meta_monitor_normal_get_main_output (MetaMonitor *monitor)
}
static void
meta_monitor_normal_derive_layout (MetaMonitor *monitor,
MetaRectangle *layout)
meta_monitor_normal_derive_dimensions (MetaMonitor *monitor,
int *width,
int *height)
{
MetaOutput *output;
output = meta_monitor_get_main_output (monitor);
*layout = (MetaRectangle) {
.x = output->crtc->rect.x,
.y = output->crtc->rect.y,
.width = output->crtc->rect.width,
.height = output->crtc->rect.height
};
}
static gboolean
meta_monitor_normal_get_suggested_position (MetaMonitor *monitor,
int *x,
int *y)
{
MetaOutput *output;
output = meta_monitor_get_main_output (monitor);
if (output->suggested_x < 0 && output->suggested_y < 0)
return FALSE;
*x = output->suggested_x;
*y = output->suggested_y;
return TRUE;
*width = output->crtc->rect.width;
*height = output->crtc->rect.height;
}
static void
@@ -517,9 +440,8 @@ meta_monitor_normal_class_init (MetaMonitorNormalClass *klass)
MetaMonitorClass *monitor_class = META_MONITOR_CLASS (klass);
monitor_class->get_main_output = meta_monitor_normal_get_main_output;
monitor_class->derive_layout = meta_monitor_normal_derive_layout;
monitor_class->derive_dimensions = meta_monitor_normal_derive_dimensions;
monitor_class->calculate_crtc_pos = meta_monitor_normal_calculate_crtc_pos;
monitor_class->get_suggested_position = meta_monitor_normal_get_suggested_position;
}
uint32_t
@@ -533,8 +455,16 @@ meta_monitor_get_suggested_position (MetaMonitor *monitor,
int *x,
int *y)
{
return META_MONITOR_GET_CLASS (monitor)->get_suggested_position (monitor,
x, y);
MetaOutput *main_output;
main_output = meta_monitor_get_main_output (monitor);
if (main_output->suggested_x < 0 && main_output->suggested_y < 0)
return FALSE;
*x = main_output->suggested_x;
*y = main_output->suggested_y;
return TRUE;
}
static void
@@ -553,7 +483,7 @@ add_tiled_monitor_outputs (MetaMonitorManager *monitor_manager,
continue;
g_warn_if_fail (output->subpixel_order ==
monitor_tiled->origin_output->subpixel_order);
monitor_tiled->main_output->subpixel_order);
monitor_priv->outputs = g_list_append (monitor_priv->outputs, output);
}
@@ -673,157 +603,41 @@ is_monitor_mode_assigned (MetaMonitor *monitor,
return TRUE;
}
static gboolean
is_crtc_mode_tiled (MetaOutput *output,
MetaCrtcMode *crtc_mode)
{
return (crtc_mode->width == (int) output->tile_info.tile_w &&
crtc_mode->height == (int) output->tile_info.tile_h);
}
static MetaCrtcMode *
find_tiled_crtc_mode (MetaOutput *output,
MetaCrtcMode *reference_crtc_mode)
{
MetaCrtcMode *crtc_mode;
unsigned int i;
crtc_mode = output->preferred_mode;
if (is_crtc_mode_tiled (output, crtc_mode))
return crtc_mode;
for (i = 0; i < output->n_modes; i++)
{
crtc_mode = output->modes[i];
if (!is_crtc_mode_tiled (output, crtc_mode))
continue;
if (crtc_mode->refresh_rate != reference_crtc_mode->refresh_rate)
continue;
if (crtc_mode->flags != reference_crtc_mode->flags)
continue;
return crtc_mode;
}
return NULL;
}
static MetaMonitorMode *
create_tiled_monitor_mode (MetaMonitorTiled *monitor_tiled,
MetaCrtcMode *reference_crtc_mode,
gboolean *out_is_preferred)
create_tiled_monitor_mode (MetaMonitorTiled *monitor_tiled)
{
MetaMonitor *monitor = META_MONITOR (monitor_tiled);
MetaMonitorPrivate *monitor_priv =
meta_monitor_get_instance_private (monitor);
MetaMonitorModeTiled *mode;
int width, height;
GList *l;
unsigned int i;
gboolean is_preferred = TRUE;
int i;
mode = g_new0 (MetaMonitorModeTiled, 1);
mode->is_tiled = TRUE;
meta_monitor_tiled_calculate_tiled_size (monitor, &width, &height);
mode->parent.spec = (MetaMonitorModeSpec) {
.width = width,
.height = height,
.refresh_rate = reference_crtc_mode->refresh_rate,
.flags = reference_crtc_mode->flags & HANDLED_CRTC_MODE_FLAGS
};
mode->parent.id = generate_mode_id (&mode->parent.spec);
meta_monitor_tiled_calculate_tiled_size (monitor,
&mode->parent.spec.width,
&mode->parent.spec.height);
mode->parent.crtc_modes = g_new0 (MetaMonitorCrtcMode,
g_list_length (monitor_priv->outputs));
for (l = monitor_priv->outputs, i = 0; l; l = l->next, i++)
{
MetaOutput *output = l->data;
MetaCrtcMode *tiled_crtc_mode;
tiled_crtc_mode = find_tiled_crtc_mode (output, reference_crtc_mode);
if (!tiled_crtc_mode)
{
g_warning ("No tiled mode found on %s", output->name);
meta_monitor_mode_free ((MetaMonitorMode *) mode);
return NULL;
}
MetaCrtcMode *preferred_crtc_mode = output->preferred_mode;
mode->parent.crtc_modes[i] = (MetaMonitorCrtcMode) {
.output = output,
.crtc_mode = tiled_crtc_mode
.crtc_mode = preferred_crtc_mode
};
is_preferred = is_preferred && tiled_crtc_mode == output->preferred_mode;
g_warn_if_fail (mode->parent.spec.refresh_rate == 0.0f ||
(mode->parent.spec.refresh_rate ==
preferred_crtc_mode->refresh_rate));
mode->parent.spec.refresh_rate = preferred_crtc_mode->refresh_rate;
}
*out_is_preferred = is_preferred;
return (MetaMonitorMode *) mode;
}
static void
generate_tiled_monitor_modes (MetaMonitorTiled *monitor_tiled)
{
MetaMonitor *monitor = META_MONITOR (monitor_tiled);
MetaMonitorPrivate *monitor_priv =
meta_monitor_get_instance_private (monitor);
MetaOutput *main_output;
GList *tiled_modes = NULL;
unsigned int i;
MetaMonitorMode *best_mode = NULL;
GList *l;
main_output = meta_monitor_get_main_output (META_MONITOR (monitor_tiled));
for (i = 0; i < main_output->n_modes; i++)
{
MetaCrtcMode *reference_crtc_mode = main_output->modes[i];
MetaMonitorMode *mode;
gboolean is_preferred;
if (!is_crtc_mode_tiled (main_output, reference_crtc_mode))
continue;
mode = create_tiled_monitor_mode (monitor_tiled, reference_crtc_mode,
&is_preferred);
if (!mode)
continue;
tiled_modes = g_list_append (tiled_modes, mode);
if (is_monitor_mode_assigned (monitor, mode))
monitor_priv->current_mode = mode;
if (is_preferred)
monitor_priv->preferred_mode = mode;
}
while ((l = tiled_modes))
{
MetaMonitorMode *mode = l->data;
tiled_modes = g_list_remove_link (tiled_modes, l);
if (!meta_monitor_add_mode (monitor, mode))
{
meta_monitor_mode_free (mode);
continue;
}
if (!monitor_priv->preferred_mode)
{
if (!best_mode ||
mode->spec.refresh_rate > best_mode->spec.refresh_rate)
best_mode = mode;
}
}
if (best_mode)
monitor_priv->preferred_mode = best_mode;
return &mode->parent;
}
static MetaMonitorMode *
@@ -838,7 +652,12 @@ create_untiled_monitor_mode (MetaMonitorTiled *monitor_tiled,
GList *l;
int i;
if (is_crtc_mode_tiled (main_output, crtc_mode))
/*
* Assume modes with a resolution identical to the tile sizes are tiled
* modes.
*/
if (crtc_mode->width == (int) main_output->tile_info.tile_w &&
crtc_mode->height == (int) main_output->tile_info.tile_h)
return NULL;
mode = g_new0 (MetaMonitorModeTiled, 1);
@@ -847,12 +666,10 @@ create_untiled_monitor_mode (MetaMonitorTiled *monitor_tiled,
mode->parent.spec = (MetaMonitorModeSpec) {
.width = crtc_mode->width,
.height = crtc_mode->height,
.refresh_rate = crtc_mode->refresh_rate,
.flags = crtc_mode->flags & HANDLED_CRTC_MODE_FLAGS
.refresh_rate = crtc_mode->refresh_rate
};
mode->parent.id = generate_mode_id (&mode->parent.spec);
mode->parent.crtc_modes = g_new0 (MetaMonitorCrtcMode,
g_list_length (monitor_priv->outputs));
g_list_length (monitor_priv->outputs));
for (l = monitor_priv->outputs, i = 0; l; l = l->next, i++)
{
@@ -877,188 +694,42 @@ create_untiled_monitor_mode (MetaMonitorTiled *monitor_tiled,
return &mode->parent;
}
static int
count_untiled_crtc_modes (MetaOutput *output)
{
int count;
unsigned int i;
count = 0;
for (i = 0; i < output->n_modes; i++)
{
MetaCrtcMode *crtc_mode = output->modes[i];
if (!is_crtc_mode_tiled (output, crtc_mode))
count++;
}
return count;
}
static MetaOutput *
find_untiled_output (MetaMonitorTiled *monitor_tiled)
{
MetaMonitor *monitor = META_MONITOR (monitor_tiled);
MetaMonitorPrivate *monitor_priv =
meta_monitor_get_instance_private (monitor);
MetaOutput *best_output;
int best_untiled_crtc_mode_count;
GList *l;
best_output = monitor_tiled->origin_output;
best_untiled_crtc_mode_count =
count_untiled_crtc_modes (monitor_tiled->origin_output);
for (l = monitor_priv->outputs; l; l = l->next)
{
MetaOutput *output = l->data;
int untiled_crtc_mode_count;
if (output == monitor_tiled->origin_output)
continue;
untiled_crtc_mode_count = count_untiled_crtc_modes (output);
if (untiled_crtc_mode_count > best_untiled_crtc_mode_count)
{
best_untiled_crtc_mode_count = untiled_crtc_mode_count;
best_output = output;
}
}
return best_output;
}
static void
generate_untiled_monitor_modes (MetaMonitorTiled *monitor_tiled)
{
MetaMonitor *monitor = META_MONITOR (monitor_tiled);
MetaMonitorPrivate *monitor_priv =
meta_monitor_get_instance_private (monitor);
MetaOutput *main_output;
unsigned int i;
main_output = meta_monitor_get_main_output (monitor);
for (i = 0; i < main_output->n_modes; i++)
{
MetaCrtcMode *crtc_mode = main_output->modes[i];
MetaMonitorMode *mode;
mode = create_untiled_monitor_mode (monitor_tiled,
main_output,
crtc_mode);
if (!mode)
continue;
if (!meta_monitor_add_mode (monitor, mode))
{
meta_monitor_mode_free (mode);
continue;
}
if (is_monitor_mode_assigned (monitor, mode))
{
g_assert (!monitor_priv->current_mode);
monitor_priv->current_mode = mode;
}
if (!monitor_priv->preferred_mode &&
crtc_mode == main_output->preferred_mode)
monitor_priv->preferred_mode = mode;
}
}
static MetaMonitorMode *
find_best_mode (MetaMonitor *monitor)
{
MetaMonitorPrivate *monitor_priv =
meta_monitor_get_instance_private (monitor);
MetaMonitorMode *best_mode = NULL;
GList *l;
for (l = monitor_priv->modes; l; l = l->next)
{
MetaMonitorMode *mode = l->data;
int area, best_area;
if (!best_mode)
{
best_mode = mode;
continue;
}
area = mode->spec.width * mode->spec.height;
best_area = best_mode->spec.width * best_mode->spec.height;
if (area > best_area)
{
best_mode = mode;
continue;
}
if (mode->spec.refresh_rate > best_mode->spec.refresh_rate)
{
best_mode = mode;
continue;
}
}
return best_mode;
}
static void
meta_monitor_tiled_generate_modes (MetaMonitorTiled *monitor_tiled)
{
MetaMonitor *monitor = META_MONITOR (monitor_tiled);
MetaMonitorPrivate *monitor_priv =
meta_monitor_get_instance_private (monitor);
MetaMonitorMode *mode;
MetaOutput *main_output;
unsigned int i;
/*
* Tiled monitors may look a bit different from each other, depending on the
* monitor itself, the driver, etc.
*
* On some, the tiled modes will be the preferred CRTC modes, and running
* untiled is done by only enabling (0, 0) tile. In this case, things are
* pretty straight forward.
*
* Other times a monitor may have some bogus mode preferred on the main tile,
* and an untiled mode preferred on the non-main tile, and there seems to be
* no guarantee that the (0, 0) tile is the one that should drive the
* non-tiled mode.
*
* To handle both these cases, the following hueristics are implemented:
*
* 1) Find all the tiled CRTC modes of the (0, 0) tile, and create tiled
* monitor modes for all tiles based on these.
* 2) If there is any tiled monitor mode combination where all CRTC modes
* are the preferred ones, that one is marked as preferred.
* 3) If there is no preferred mode determined so far, assume the tiled
* monitor mode with the highest refresh rate is preferred.
* 4) Find the tile with highest number of untiled CRTC modes available,
* assume this is the one driving the monitor in untiled mode, and
* create monitor modes for all untiled CRTC modes of that tile. If
* there is still no preferred mode, set any untiled mode as preferred
* if the CRTC mode is marked as such.
* 5) If at this point there is still no preferred mode, just pick the one
* with the highest number of pixels and highest refresh rate.
*
* Note that this ignores the preference if the preference is a non-tiled
* mode. This seems to be the case on some systems, where the user tends to
* manually set up the tiled mode anyway.
*/
mode = create_tiled_monitor_mode (monitor_tiled);
monitor_priv->modes = g_list_append (monitor_priv->modes, mode);
generate_tiled_monitor_modes (monitor_tiled);
monitor_priv->preferred_mode = mode;
if (!monitor_priv->preferred_mode)
g_warning ("Tiled monitor on %s didn't have any tiled modes",
monitor_priv->spec->connector);
if (is_monitor_mode_assigned (monitor, mode))
monitor_priv->current_mode = mode;
generate_untiled_monitor_modes (monitor_tiled);
if (!monitor_priv->preferred_mode)
main_output = meta_monitor_get_main_output (monitor);
for (i = 0; i < main_output->n_modes; i++)
{
g_warning ("Tiled monitor on %s didn't have a valid preferred mode",
monitor_priv->spec->connector);
monitor_priv->preferred_mode = find_best_mode (monitor);
MetaCrtcMode *crtc_mode = main_output->modes[i];
mode = create_untiled_monitor_mode (monitor_tiled,
main_output,
crtc_mode);
if (mode)
{
monitor_priv->modes = g_list_append (monitor_priv->modes, mode);
if (is_monitor_mode_assigned (monitor, mode))
{
g_assert (!monitor_priv->current_mode);
monitor_priv->current_mode = mode;
}
}
}
}
@@ -1074,22 +745,17 @@ meta_monitor_tiled_new (MetaMonitorManager *monitor_manager,
monitor = META_MONITOR (monitor_tiled);
monitor_priv = meta_monitor_get_instance_private (monitor);
monitor_priv->monitor_manager = monitor_manager;
monitor_tiled->tile_group_id = output->tile_info.group_id;
monitor_priv->winsys_id = output->winsys_id;
monitor_tiled->origin_output = output;
monitor_tiled->main_output = output;
add_tiled_monitor_outputs (monitor_manager, monitor_tiled);
monitor_tiled->main_output = find_untiled_output (monitor_tiled);
meta_monitor_generate_spec (monitor);
meta_monitor_manager_tiled_monitor_added (monitor_manager,
META_MONITOR (monitor_tiled));
meta_monitor_tiled_generate_modes (monitor_tiled);
meta_monitor_generate_id (monitor);
return monitor_tiled;
}
@@ -1103,8 +769,9 @@ meta_monitor_tiled_get_main_output (MetaMonitor *monitor)
}
static void
meta_monitor_derived_derive_layout (MetaMonitor *monitor,
MetaRectangle *layout)
meta_monitor_tiled_derive_dimensions (MetaMonitor *monitor,
int *out_width,
int *out_height)
{
MetaMonitorPrivate *monitor_priv =
meta_monitor_get_instance_private (monitor);
@@ -1128,20 +795,8 @@ meta_monitor_derived_derive_layout (MetaMonitor *monitor,
max_y = MAX (output->crtc->rect.y + output->crtc->rect.height, max_y);
}
*layout = (MetaRectangle) {
.x = min_x,
.y = min_y,
.width = max_x - min_x,
.height = max_y - min_y
};
}
static gboolean
meta_monitor_tiled_get_suggested_position (MetaMonitor *monitor,
int *x,
int *y)
{
return FALSE;
*out_width = max_x - min_x;
*out_height = max_y - min_y;
}
static void
@@ -1169,12 +824,13 @@ meta_monitor_tiled_calculate_crtc_pos (MetaMonitor *monitor,
static void
meta_monitor_tiled_finalize (GObject *object)
{
MetaMonitor *monitor = META_MONITOR (object);
MetaMonitorPrivate *monitor_priv =
meta_monitor_get_instance_private (monitor);
MetaMonitorTiled *monitor_tiled = META_MONITOR_TILED (object);
MetaBackend *backend = meta_get_backend ();
MetaMonitorManager *monitor_manager =
meta_backend_get_monitor_manager (backend);
meta_monitor_manager_tiled_monitor_removed (monitor_priv->monitor_manager,
monitor);
meta_monitor_manager_tiled_monitor_removed (monitor_manager,
META_MONITOR (monitor_tiled));
}
static void
@@ -1191,15 +847,13 @@ meta_monitor_tiled_class_init (MetaMonitorTiledClass *klass)
object_class->finalize = meta_monitor_tiled_finalize;
monitor_class->get_main_output = meta_monitor_tiled_get_main_output;
monitor_class->derive_layout = meta_monitor_derived_derive_layout;
monitor_class->derive_dimensions = meta_monitor_tiled_derive_dimensions;
monitor_class->calculate_crtc_pos = meta_monitor_tiled_calculate_crtc_pos;
monitor_class->get_suggested_position = meta_monitor_tiled_get_suggested_position;
}
static void
meta_monitor_mode_free (MetaMonitorMode *monitor_mode)
{
g_free (monitor_mode->id);
g_free (monitor_mode->crtc_modes);
g_free (monitor_mode);
}
@@ -1223,15 +877,6 @@ meta_monitor_get_logical_monitor (MetaMonitor *monitor)
return NULL;
}
MetaMonitorMode *
meta_monitor_get_mode_from_id (MetaMonitor *monitor,
const char *monitor_mode_id)
{
MetaMonitorPrivate *priv = meta_monitor_get_instance_private (monitor);
return g_hash_table_lookup (priv->mode_ids, monitor_mode_id);
}
static gboolean
meta_monitor_mode_spec_equals (MetaMonitorModeSpec *monitor_mode_spec,
MetaMonitorModeSpec *other_monitor_mode_spec)
@@ -1239,8 +884,7 @@ meta_monitor_mode_spec_equals (MetaMonitorModeSpec *monitor_mode_spec,
return (monitor_mode_spec->width == other_monitor_mode_spec->width &&
monitor_mode_spec->height == other_monitor_mode_spec->height &&
(monitor_mode_spec->refresh_rate ==
other_monitor_mode_spec->refresh_rate) &&
monitor_mode_spec->flags == other_monitor_mode_spec->flags);
other_monitor_mode_spec->refresh_rate));
}
MetaMonitorMode *
@@ -1332,218 +976,12 @@ meta_monitor_calculate_crtc_pos (MetaMonitor *monitor,
out_y);
}
/* The minimum resolution at which we turn on a window-scale of 2 */
#define HIDPI_LIMIT 192
/*
* The minimum screen height at which we turn on a window-scale of 2;
* below this there just isn't enough vertical real estate for GNOME
* apps to work, and it's better to just be tiny
*/
#define HIDPI_MIN_HEIGHT 1200
/* From http://en.wikipedia.org/wiki/4K_resolution#Resolutions_of_common_formats */
#define SMALLEST_4K_WIDTH 3656
static float
calculate_scale (MetaMonitor *monitor,
MetaMonitorMode *monitor_mode)
{
int resolution_width, resolution_height;
int width_mm, height_mm;
int scale;
scale = 1.0;
meta_monitor_mode_get_resolution (monitor_mode,
&resolution_width,
&resolution_height);
if (resolution_height < HIDPI_MIN_HEIGHT)
goto out;
/* 4K TV */
switch (meta_monitor_get_connector_type (monitor))
{
case META_CONNECTOR_TYPE_HDMIA:
case META_CONNECTOR_TYPE_HDMIB:
if (resolution_width < SMALLEST_4K_WIDTH)
goto out;
break;
default:
break;
}
meta_monitor_get_physical_dimensions (monitor, &width_mm, &height_mm);
/*
* Somebody encoded the aspect ratio (16/9 or 16/10) instead of the physical
* size.
*/
if ((width_mm == 160 && height_mm == 90) ||
(width_mm == 160 && height_mm == 100) ||
(width_mm == 16 && height_mm == 9) ||
(width_mm == 16 && height_mm == 10))
goto out;
if (width_mm > 0 && height_mm > 0)
{
double dpi_x, dpi_y;
dpi_x = (double) resolution_width / (width_mm / 25.4);
dpi_y = (double) resolution_height / (height_mm / 25.4);
/*
* We don't completely trust these values so both must be high, and never
* pick higher ratio than 2 automatically.
*/
if (dpi_x > HIDPI_LIMIT && dpi_y > HIDPI_LIMIT)
scale = 2.0;
}
out:
return scale;
}
float
meta_monitor_calculate_mode_scale (MetaMonitor *monitor,
MetaMonitorMode *monitor_mode)
{
MetaBackend *backend = meta_get_backend ();
MetaSettings *settings = meta_backend_get_settings (backend);
int global_scaling_factor;
if (meta_settings_get_global_scaling_factor (settings,
&global_scaling_factor))
return global_scaling_factor;
return calculate_scale (monitor, monitor_mode);
}
static float
get_closest_scale_factor_for_resolution (float width,
float height,
float scale,
float scale_step)
{
unsigned int i, j;
float scaled_h;
float scaled_w;
float best_scale;
int base_scaled_w;
gboolean limit_exceeded;
gboolean found_one;
best_scale = 0;
scaled_w = width / scale;
scaled_h = height / scale;
if (scale < MINIMUM_SCALE_FACTOR || scale > MAXIMUM_SCALE_FACTOR)
goto out;
if (floorf (scaled_w) == scaled_w && floorf (scaled_h) == scaled_h)
return scale;
i = 0;
found_one = FALSE;
limit_exceeded = FALSE;
base_scaled_w = floorf (scaled_w);
do
{
for (j = 0; j < 2; j++)
{
float current_scale;
int offset = i * (j ? 1 : -1);
scaled_w = base_scaled_w + offset;
current_scale = width / scaled_w;
scaled_h = height / current_scale;
if (current_scale >= scale + scale_step ||
current_scale <= scale - scale_step ||
current_scale < MINIMUM_SCALE_FACTOR ||
current_scale > MAXIMUM_SCALE_FACTOR)
{
limit_exceeded = TRUE;
continue;
}
if (floorf (scaled_h) == scaled_h)
{
found_one = TRUE;
if (fabsf (current_scale - scale) < fabsf (best_scale - scale))
best_scale = current_scale;
}
}
i++;
}
while (!found_one && !limit_exceeded);
out:
return best_scale;
}
float *
meta_monitor_calculate_supported_scales (MetaMonitor *monitor,
MetaMonitorMode *monitor_mode,
MetaMonitorScalesConstraint constraints,
int *n_supported_scales)
{
unsigned int i, j;
int width, height;
float scale_steps;
GArray *supported_scales;
scale_steps = 1.0 / (float) SCALE_FACTORS_PER_INTEGER;
supported_scales = g_array_new (FALSE, FALSE, sizeof (float));
meta_monitor_mode_get_resolution (monitor_mode, &width, &height);
for (i = floorf (MINIMUM_SCALE_FACTOR);
i <= ceilf (MAXIMUM_SCALE_FACTOR);
i++)
{
for (j = 0; j < SCALE_FACTORS_PER_INTEGER; j++)
{
float scale;
float scale_value = i + j * scale_steps;
if ((constraints & META_MONITOR_SCALES_CONSTRAINT_NO_FRAC) &&
fmodf (scale_value, 1.0) != 0.0)
{
continue;
}
scale = get_closest_scale_factor_for_resolution (width,
height,
scale_value,
scale_steps);
if (scale > 0.0f)
g_array_append_val (supported_scales, scale);
}
}
*n_supported_scales = supported_scales->len;
return (float *) g_array_free (supported_scales, FALSE);
}
MetaMonitorModeSpec *
meta_monitor_mode_get_spec (MetaMonitorMode *monitor_mode)
{
return &monitor_mode->spec;
}
const char *
meta_monitor_mode_get_id (MetaMonitorMode *monitor_mode)
{
return monitor_mode->id;
}
void
meta_monitor_mode_get_resolution (MetaMonitorMode *monitor_mode,
int *width,
@@ -1559,12 +997,6 @@ meta_monitor_mode_get_refresh_rate (MetaMonitorMode *monitor_mode)
return monitor_mode->spec.refresh_rate;
}
MetaCrtcModeFlag
meta_monitor_mode_get_flags (MetaMonitorMode *monitor_mode)
{
return monitor_mode->spec.flags;
}
gboolean
meta_monitor_mode_foreach_crtc (MetaMonitor *monitor,
MetaMonitorMode *mode,

View File

@@ -39,7 +39,6 @@ typedef struct _MetaMonitorModeSpec
int width;
int height;
float refresh_rate;
MetaCrtcModeFlag flags;
} MetaMonitorModeSpec;
typedef struct _MetaMonitorCrtcMode
@@ -54,12 +53,6 @@ typedef gboolean (* MetaMonitorModeFunc) (MetaMonitor *monitor,
gpointer user_data,
GError **error);
typedef enum _MetaMonitorScalesConstraint
{
META_MONITOR_SCALES_CONSTRAINT_NONE = 0,
META_MONITOR_SCALES_CONSTRAINT_NO_FRAC = (1 << 0),
} MetaMonitorScalesConstraint;
#define META_TYPE_MONITOR (meta_monitor_get_type ())
G_DECLARE_DERIVABLE_TYPE (MetaMonitor, meta_monitor, META, MONITOR, GObject)
@@ -68,17 +61,15 @@ struct _MetaMonitorClass
GObjectClass parent_class;
MetaOutput * (* get_main_output) (MetaMonitor *monitor);
void (* derive_layout) (MetaMonitor *monitor,
MetaRectangle *layout);
void (* derive_dimensions) (MetaMonitor *monitor,
int *width,
int *height);
void (* calculate_crtc_pos) (MetaMonitor *monitor,
MetaMonitorMode *monitor_mode,
MetaOutput *output,
MetaMonitorTransform crtc_transform,
int *out_x,
int *out_y);
gboolean (* get_suggested_position) (MetaMonitor *monitor,
int *width,
int *height);
};
#define META_TYPE_MONITOR_NORMAL (meta_monitor_normal_get_type ())
@@ -94,8 +85,7 @@ G_DECLARE_FINAL_TYPE (MetaMonitorTiled, meta_monitor_tiled,
MetaMonitorTiled * meta_monitor_tiled_new (MetaMonitorManager *monitor_manager,
MetaOutput *main_output);
MetaMonitorNormal * meta_monitor_normal_new (MetaMonitorManager *monitor_manager,
MetaOutput *output);
MetaMonitorNormal * meta_monitor_normal_new (MetaOutput *output);
MetaMonitorSpec * meta_monitor_get_spec (MetaMonitor *monitor);
@@ -117,8 +107,9 @@ void meta_monitor_get_current_resolution (MetaMonitor *monitor,
int *width,
int *height);
void meta_monitor_derive_layout (MetaMonitor *monitor,
MetaRectangle *layout);
void meta_monitor_derive_dimensions (MetaMonitor *monitor,
int *width,
int *height);
void meta_monitor_get_physical_dimensions (MetaMonitor *monitor,
int *width_mm,
@@ -144,9 +135,6 @@ gboolean meta_monitor_get_suggested_position (MetaMonitor *monitor,
MetaLogicalMonitor * meta_monitor_get_logical_monitor (MetaMonitor *monitor);
MetaMonitorMode * meta_monitor_get_mode_from_id (MetaMonitor *monitor,
const char *monitor_mode_id);
MetaMonitorMode * meta_monitor_get_mode_from_spec (MetaMonitor *monitor,
MetaMonitorModeSpec *monitor_mode_spec);
@@ -168,16 +156,6 @@ void meta_monitor_calculate_crtc_pos (MetaMonitor *monitor,
int *out_x,
int *out_y);
float meta_monitor_calculate_mode_scale (MetaMonitor *monitor,
MetaMonitorMode *monitor_mode);
float * meta_monitor_calculate_supported_scales (MetaMonitor *monitor,
MetaMonitorMode *monitor_mode,
MetaMonitorScalesConstraint constraints,
int *n_supported_scales);
const char * meta_monitor_mode_get_id (MetaMonitorMode *monitor_mode);
MetaMonitorModeSpec * meta_monitor_mode_get_spec (MetaMonitorMode *monitor_mode);
void meta_monitor_mode_get_resolution (MetaMonitorMode *monitor_mode,
@@ -186,8 +164,6 @@ void meta_monitor_mode_get_resolution (MetaMonitorMode *monitor_mode,
float meta_monitor_mode_get_refresh_rate (MetaMonitorMode *monitor_mode);
MetaCrtcModeFlag meta_monitor_mode_get_flags (MetaMonitorMode *monitor_mode);
gboolean meta_monitor_mode_foreach_crtc (MetaMonitor *monitor,
MetaMonitorMode *mode,
MetaMonitorModeFunc func,

View File

@@ -1,280 +0,0 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* Copyright (C) 2017 Red Hat
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#include "config.h"
#include <gio/gio.h>
#include "backends/meta-orientation-manager.h"
enum
{
ORIENTATION_CHANGED,
N_SIGNALS
};
static guint signals[N_SIGNALS];
struct _MetaOrientationManager
{
GObject parent_instance;
GCancellable *cancellable;
guint iio_watch_id;
GDBusProxy *iio_proxy;
MetaOrientation prev_orientation;
MetaOrientation curr_orientation;
GSettings *settings;
};
G_DEFINE_TYPE (MetaOrientationManager, meta_orientation_manager, G_TYPE_OBJECT)
#define CONF_SCHEMA "org.gnome.settings-daemon.peripherals.touchscreen"
#define ORIENTATION_LOCK_KEY "orientation-lock"
static MetaOrientation
orientation_from_string (const char *orientation)
{
if (g_strcmp0 (orientation, "normal") == 0)
return META_ORIENTATION_NORMAL;
if (g_strcmp0 (orientation, "bottom-up") == 0)
return META_ORIENTATION_BOTTOM_UP;
if (g_strcmp0 (orientation, "left-up") == 0)
return META_ORIENTATION_LEFT_UP;
if (g_strcmp0 (orientation, "right-up") == 0)
return META_ORIENTATION_RIGHT_UP;
return META_ORIENTATION_UNDEFINED;
}
static void
read_iio_proxy (MetaOrientationManager *self)
{
gboolean has_accel = FALSE;
GVariant *v;
self->curr_orientation = META_ORIENTATION_UNDEFINED;
if (!self->iio_proxy)
return;
v = g_dbus_proxy_get_cached_property (self->iio_proxy, "HasAccelerometer");
if (v)
{
has_accel = g_variant_get_boolean (v);
g_variant_unref (v);
}
if (has_accel)
{
v = g_dbus_proxy_get_cached_property (self->iio_proxy, "AccelerometerOrientation");
if (v)
{
self->curr_orientation = orientation_from_string (g_variant_get_string (v, NULL));
g_variant_unref (v);
}
}
}
static void
sync_state (MetaOrientationManager *self)
{
read_iio_proxy (self);
if (self->prev_orientation == self->curr_orientation)
return;
self->prev_orientation = self->curr_orientation;
if (self->curr_orientation == META_ORIENTATION_UNDEFINED)
return;
if (g_settings_get_boolean (self->settings, ORIENTATION_LOCK_KEY))
return;
g_signal_emit (self, signals[ORIENTATION_CHANGED], 0);
}
static void
orientation_lock_changed (GSettings *settings,
gchar *key,
gpointer user_data)
{
MetaOrientationManager *self = user_data;
sync_state (self);
}
static void
iio_properties_changed (GDBusProxy *proxy,
GVariant *changed_properties,
GStrv invalidated_properties,
gpointer user_data)
{
MetaOrientationManager *self = user_data;
sync_state (self);
}
static void
accelerometer_claimed (GObject *source,
GAsyncResult *res,
gpointer user_data)
{
MetaOrientationManager *self = user_data;
GVariant *v;
GError *error = NULL;
v = g_dbus_proxy_call_finish (G_DBUS_PROXY (source), res, &error);
if (!v)
{
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
g_warning ("Failed to claim accelerometer: %s", error->message);
g_error_free (error);
return;
}
g_variant_unref (v);
sync_state (self);
}
static void
iio_proxy_ready (GObject *source,
GAsyncResult *res,
gpointer user_data)
{
MetaOrientationManager *self = user_data;
GDBusProxy *proxy;
GError *error = NULL;
proxy = g_dbus_proxy_new_finish (res, &error);
if (!proxy)
{
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
g_warning ("Failed to obtain IIO DBus proxy: %s", error->message);
g_error_free (error);
return;
}
self->iio_proxy = proxy;
g_signal_connect_object (self->iio_proxy, "g-properties-changed",
G_CALLBACK (iio_properties_changed), self, 0);
g_dbus_proxy_call (self->iio_proxy,
"ClaimAccelerometer",
NULL,
G_DBUS_CALL_FLAGS_NONE,
-1,
self->cancellable,
accelerometer_claimed,
self);
}
static void
iio_sensor_appeared_cb (GDBusConnection *connection,
const gchar *name,
const gchar *name_owner,
gpointer user_data)
{
MetaOrientationManager *self = user_data;
self->cancellable = g_cancellable_new ();
g_dbus_proxy_new (connection,
G_DBUS_PROXY_FLAGS_NONE,
NULL,
"net.hadess.SensorProxy",
"/net/hadess/SensorProxy",
"net.hadess.SensorProxy",
self->cancellable,
iio_proxy_ready,
self);
}
static void
iio_sensor_vanished_cb (GDBusConnection *connection,
const gchar *name,
gpointer user_data)
{
MetaOrientationManager *self = user_data;
g_cancellable_cancel (self->cancellable);
g_clear_object (&self->cancellable);
g_clear_object (&self->iio_proxy);
sync_state (self);
}
static void
meta_orientation_manager_init (MetaOrientationManager *self)
{
self->iio_watch_id = g_bus_watch_name (G_BUS_TYPE_SYSTEM,
"net.hadess.SensorProxy",
G_BUS_NAME_WATCHER_FLAGS_NONE,
iio_sensor_appeared_cb,
iio_sensor_vanished_cb,
self,
NULL);
self->settings = g_settings_new (CONF_SCHEMA);
g_signal_connect_object (self->settings, "changed::"ORIENTATION_LOCK_KEY,
G_CALLBACK (orientation_lock_changed), self, 0);
sync_state (self);
}
static void
meta_orientation_manager_finalize (GObject *object)
{
MetaOrientationManager *self = META_ORIENTATION_MANAGER (object);
g_cancellable_cancel (self->cancellable);
g_clear_object (&self->cancellable);
g_bus_unwatch_name (self->iio_watch_id);
g_clear_object (&self->iio_proxy);
g_clear_object (&self->settings);
G_OBJECT_CLASS (meta_orientation_manager_parent_class)->finalize (object);
}
static void
meta_orientation_manager_class_init (MetaOrientationManagerClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
gobject_class->finalize = meta_orientation_manager_finalize;
signals[ORIENTATION_CHANGED] =
g_signal_new ("orientation-changed",
G_TYPE_FROM_CLASS (gobject_class),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
G_TYPE_NONE, 0);
}
MetaOrientation
meta_orientation_manager_get_orientation (MetaOrientationManager *self)
{
return self->curr_orientation;
}

View File

@@ -1,40 +0,0 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* Copyright (C) 2017 Red Hat
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#ifndef META_ORIENTATION_MANAGER_H
#define META_ORIENTATION_MANAGER_H
typedef enum
{
META_ORIENTATION_UNDEFINED,
META_ORIENTATION_NORMAL,
META_ORIENTATION_BOTTOM_UP,
META_ORIENTATION_LEFT_UP,
META_ORIENTATION_RIGHT_UP
} MetaOrientation;
#define META_TYPE_ORIENTATION_MANAGER (meta_orientation_manager_get_type ())
G_DECLARE_FINAL_TYPE (MetaOrientationManager, meta_orientation_manager,
META, ORIENTATION_MANAGER, GObject)
MetaOrientation meta_orientation_manager_get_orientation (MetaOrientationManager *self);
#endif /* META_ORIENTATION_MANAGER_H */

View File

@@ -1,60 +0,0 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* Copyright (C) 2017 Red Hat
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#ifndef META_SETTINGS_PRIVATE_H
#define META_SETTINGS_PRIVATE_H
#include <glib-object.h>
#include "meta/meta-settings.h"
#include "meta/types.h"
typedef enum _MetaExperimentalFeature
{
META_EXPERIMENTAL_FEATURE_NONE = 0,
META_EXPERIMENTAL_FEATURE_SCALE_MONITOR_FRAMEBUFFER = (1 << 0),
META_EXPERIMENTAL_FEATURE_MONITOR_CONFIG_MANAGER = (1 << 1)
} MetaExperimentalFeature;
#define META_TYPE_SETTINGS (meta_settings_get_type ())
G_DECLARE_FINAL_TYPE (MetaSettings, meta_settings,
META, SETTINGS, GObject)
MetaSettings * meta_settings_new (MetaBackend *backend);
void meta_settings_post_init (MetaSettings *settings);
void meta_settings_update_ui_scaling_factor (MetaSettings *settings);
gboolean meta_settings_get_global_scaling_factor (MetaSettings *settings,
int *scaing_factor);
gboolean meta_settings_is_experimental_feature_enabled (MetaSettings *settings,
MetaExperimentalFeature feature);
MetaExperimentalFeature meta_settings_get_experimental_features (MetaSettings *settings);
void meta_settings_override_experimental_features (MetaSettings *settings);
void meta_settings_enable_experimental_feature (MetaSettings *settings,
MetaExperimentalFeature feature);
#endif /* META_SETTINGS_PRIVATE_H */

View File

@@ -1,452 +0,0 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* Copyright (C) 2017 Red Hat
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#include "config.h"
#include "backends/meta-settings-private.h"
#include <gio/gio.h>
#include "backends/meta-backend-private.h"
#include "backends/meta-logical-monitor.h"
#include "backends/meta-monitor-manager-private.h"
#include "ui/theme-private.h"
enum
{
UI_SCALING_FACTOR_CHANGED,
GLOBAL_SCALING_FACTOR_CHANGED,
FONT_DPI_CHANGED,
EXPERIMENTAL_FEATURES_CHANGED,
N_SIGNALS
};
static guint signals[N_SIGNALS];
struct _MetaSettings
{
GObject parent;
MetaBackend *backend;
GSettings *interface_settings;
GSettings *mutter_settings;
int ui_scaling_factor;
int global_scaling_factor;
int font_dpi;
MetaExperimentalFeature experimental_features;
gboolean experimental_features_overridden;
};
G_DEFINE_TYPE (MetaSettings, meta_settings, G_TYPE_OBJECT)
static int
calculate_ui_scaling_factor (MetaSettings *settings)
{
MetaMonitorManager *monitor_manager =
meta_backend_get_monitor_manager (settings->backend);
GList *logical_monitors;
GList *l;
float max_scale = 1.0;
logical_monitors =
meta_monitor_manager_get_logical_monitors (monitor_manager);
for (l = logical_monitors; l; l = l->next)
{
MetaLogicalMonitor *logical_monitor = l->data;
max_scale = MAX (meta_logical_monitor_get_scale (logical_monitor),
max_scale);
}
g_warn_if_fail (fmodf (max_scale, 1.0) == 0.0);
return (int) max_scale;
}
static int
get_xsettings_scaling_factor (void)
{
GdkScreen *screen;
GValue value = G_VALUE_INIT;
g_value_init (&value, G_TYPE_INT);
screen = gdk_screen_get_default ();
if (gdk_screen_get_setting (screen, "gdk-window-scaling-factor", &value))
return g_value_get_int (&value);
else
return 1;
}
static gboolean
update_ui_scaling_factor (MetaSettings *settings)
{
int ui_scaling_factor;
if (meta_is_stage_views_scaled ())
{
ui_scaling_factor = 1;
}
else
{
if (meta_is_monitor_config_manager_enabled ())
ui_scaling_factor = calculate_ui_scaling_factor (settings);
else
ui_scaling_factor = get_xsettings_scaling_factor ();
}
if (settings->ui_scaling_factor != ui_scaling_factor)
{
settings->ui_scaling_factor = ui_scaling_factor;
return TRUE;
}
else
{
return FALSE;
}
}
static void
xft_dpi_changed (GtkSettings *gtk_settings,
GParamSpec *pspec,
MetaSettings *settings)
{
/* This only matters when we rely on XSettings. */
if (meta_is_monitor_config_manager_enabled ())
return;
meta_settings_update_ui_scaling_factor (settings);
}
static void
x11_display_opened (MetaBackend *backend,
MetaSettings *settings)
{
/*
* gdk-window-scaling-factor is not exported to gtk-settings
* because it is handled inside gdk, so we use gtk-xft-dpi instead
* which also changes when the scale factor changes.
*
* TODO: Only rely on our own configured scale when we only have
* MetaMonitorConfigManager.
*/
g_signal_connect (gtk_settings_get_default (), "notify::gtk-xft-dpi",
G_CALLBACK (xft_dpi_changed), settings);
}
void
meta_settings_update_ui_scaling_factor (MetaSettings *settings)
{
if (update_ui_scaling_factor (settings))
g_signal_emit (settings, signals[UI_SCALING_FACTOR_CHANGED], 0);
}
int
meta_settings_get_ui_scaling_factor (MetaSettings *settings)
{
g_assert (settings->ui_scaling_factor != 0);
return settings->ui_scaling_factor;
}
static gboolean
update_global_scaling_factor (MetaSettings *settings)
{
int global_scaling_factor;
global_scaling_factor =
(int) g_settings_get_uint (settings->interface_settings,
"scaling-factor");
if (settings->global_scaling_factor != global_scaling_factor)
{
settings->global_scaling_factor = global_scaling_factor;
return TRUE;
}
else
{
return FALSE;
}
}
gboolean
meta_settings_get_global_scaling_factor (MetaSettings *settings,
int *out_scaling_factor)
{
if (settings->global_scaling_factor == 0)
return FALSE;
*out_scaling_factor = settings->global_scaling_factor;
return TRUE;
}
static gboolean
update_font_dpi (MetaSettings *settings)
{
double text_scaling_factor;
/* Number of logical pixels on an inch when unscaled */
const double dots_per_inch = 96;
/* Being based on Xft, API users expect the DPI to be 1/1024th of an inch. */
const double xft_factor = 1024;
int font_dpi;
text_scaling_factor = g_settings_get_double (settings->interface_settings,
"text-scaling-factor");
font_dpi = (int) (text_scaling_factor *
dots_per_inch *
xft_factor *
settings->ui_scaling_factor);
if (font_dpi != settings->font_dpi)
{
settings->font_dpi = font_dpi;
g_object_set (clutter_settings_get_default (),
"font-dpi", font_dpi,
NULL);
return TRUE;
}
else
{
return FALSE;
}
}
static void
meta_settings_update_font_dpi (MetaSettings *settings)
{
if (update_font_dpi (settings))
g_signal_emit (settings, signals[FONT_DPI_CHANGED], 0);
}
int
meta_settings_get_font_dpi (MetaSettings *settings)
{
g_assert (settings->font_dpi != 0);
return settings->font_dpi;
}
static void
interface_settings_changed (GSettings *interface_settings,
const char *key,
MetaSettings *settings)
{
if (g_str_equal (key, "scaling-factor"))
{
if (update_global_scaling_factor (settings))
g_signal_emit (settings, signals[GLOBAL_SCALING_FACTOR_CHANGED], 0);
}
else if (g_str_equal (key, "text-scaling-factor"))
{
meta_settings_update_font_dpi (settings);
}
}
gboolean
meta_settings_is_experimental_feature_enabled (MetaSettings *settings,
MetaExperimentalFeature feature)
{
return !!(settings->experimental_features & feature);
}
void
meta_settings_override_experimental_features (MetaSettings *settings)
{
settings->experimental_features = META_EXPERIMENTAL_FEATURE_NONE;
settings->experimental_features_overridden = TRUE;
}
void
meta_settings_enable_experimental_feature (MetaSettings *settings,
MetaExperimentalFeature feature)
{
g_assert (settings->experimental_features_overridden);
settings->experimental_features |= feature;
}
static gboolean
experimental_features_handler (GVariant *features_variant,
gpointer *result,
gpointer data)
{
MetaSettings *settings = data;
GVariantIter features_iter;
char *feature;
MetaExperimentalFeature features = META_EXPERIMENTAL_FEATURE_NONE;
if (settings->experimental_features_overridden)
{
*result = GINT_TO_POINTER (FALSE);
return TRUE;
}
g_variant_iter_init (&features_iter, features_variant);
while (g_variant_iter_loop (&features_iter, "s", &feature))
{
/* So far no experimental features defined. */
if (g_str_equal (feature, "scale-monitor-framebuffer"))
features |= META_EXPERIMENTAL_FEATURE_SCALE_MONITOR_FRAMEBUFFER;
else if (g_str_equal (feature, "monitor-config-manager"))
features |= META_EXPERIMENTAL_FEATURE_MONITOR_CONFIG_MANAGER;
else
g_info ("Unknown experimental feature '%s'\n", feature);
}
if (features != settings->experimental_features)
{
settings->experimental_features = features;
*result = GINT_TO_POINTER (TRUE);
}
else
{
*result = GINT_TO_POINTER (FALSE);
}
return TRUE;
}
static gboolean
update_experimental_features (MetaSettings *settings)
{
return GPOINTER_TO_INT (g_settings_get_mapped (settings->mutter_settings,
"experimental-features",
experimental_features_handler,
settings));
}
static void
mutter_settings_changed (GSettings *mutter_settings,
gchar *key,
MetaSettings *settings)
{
MetaExperimentalFeature old_experimental_features;
if (!g_str_equal (key, "experimental-features"))
return;
old_experimental_features = settings->experimental_features;
if (update_experimental_features (settings))
g_signal_emit (settings, signals[EXPERIMENTAL_FEATURES_CHANGED], 0,
(unsigned int) old_experimental_features);
}
MetaSettings *
meta_settings_new (MetaBackend *backend)
{
MetaSettings *settings;
settings = g_object_new (META_TYPE_SETTINGS, NULL);
settings->backend = backend;
g_signal_connect (backend, "x11-display-opened",
G_CALLBACK (x11_display_opened),
settings);
return settings;
}
static void
meta_settings_dispose (GObject *object)
{
MetaSettings *settings = META_SETTINGS (object);
g_clear_object (&settings->mutter_settings);
g_clear_object (&settings->interface_settings);
G_OBJECT_CLASS (meta_settings_parent_class)->dispose (object);
}
static void
meta_settings_init (MetaSettings *settings)
{
settings->interface_settings = g_settings_new ("org.gnome.desktop.interface");
g_signal_connect (settings->interface_settings, "changed",
G_CALLBACK (interface_settings_changed),
settings);
settings->mutter_settings = g_settings_new ("org.gnome.mutter");
g_signal_connect (settings->mutter_settings, "changed",
G_CALLBACK (mutter_settings_changed),
settings);
/* Chain up inter-dependent settings. */
g_signal_connect (settings, "global-scaling-factor-changed",
G_CALLBACK (meta_settings_update_ui_scaling_factor), NULL);
g_signal_connect (settings, "ui-scaling-factor-changed",
G_CALLBACK (meta_settings_update_font_dpi), NULL);
update_global_scaling_factor (settings);
update_experimental_features (settings);
}
void
meta_settings_post_init (MetaSettings *settings)
{
update_ui_scaling_factor (settings);
update_font_dpi (settings);
}
static void
meta_settings_class_init (MetaSettingsClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->dispose = meta_settings_dispose;
signals[UI_SCALING_FACTOR_CHANGED] =
g_signal_new ("ui-scaling-factor-changed",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
G_TYPE_NONE, 0);
signals[GLOBAL_SCALING_FACTOR_CHANGED] =
g_signal_new ("global-scaling-factor-changed",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
G_TYPE_NONE, 0);
signals[FONT_DPI_CHANGED] =
g_signal_new ("font-dpi-changed",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
G_TYPE_NONE, 0);
signals[EXPERIMENTAL_FEATURES_CHANGED] =
g_signal_new ("experimental-features-changed",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
G_TYPE_NONE, 1, G_TYPE_UINT);
}

View File

@@ -36,8 +36,8 @@ struct _MetaOverlay {
CoglPipeline *pipeline;
CoglTexture *texture;
ClutterRect current_rect;
ClutterRect previous_rect;
MetaRectangle current_rect;
MetaRectangle previous_rect;
gboolean previous_is_valid;
};
@@ -71,9 +71,9 @@ meta_overlay_free (MetaOverlay *overlay)
}
static void
meta_overlay_set (MetaOverlay *overlay,
CoglTexture *texture,
ClutterRect *rect)
meta_overlay_set (MetaOverlay *overlay,
CoglTexture *texture,
MetaRectangle *rect)
{
if (overlay->texture != texture)
{
@@ -104,12 +104,12 @@ meta_overlay_paint (MetaOverlay *overlay)
cogl_framebuffer_draw_rectangle (cogl_get_draw_framebuffer (),
overlay->pipeline,
overlay->current_rect.origin.x,
overlay->current_rect.origin.y,
(overlay->current_rect.origin.x +
overlay->current_rect.size.width),
(overlay->current_rect.origin.y +
overlay->current_rect.size.height));
overlay->current_rect.x,
overlay->current_rect.y,
overlay->current_rect.x +
overlay->current_rect.width,
overlay->current_rect.y +
overlay->current_rect.height);
overlay->previous_rect = overlay->current_rect;
overlay->previous_is_valid = TRUE;
@@ -204,10 +204,10 @@ queue_redraw_for_overlay (MetaStage *stage,
/* Clear the location the overlay was at before, if we need to. */
if (overlay->previous_is_valid)
{
clip.x = floorf (overlay->previous_rect.origin.x),
clip.y = floorf (overlay->previous_rect.origin.y),
clip.width = ceilf (overlay->previous_rect.size.width),
clip.height = ceilf (overlay->previous_rect.size.height),
clip.x = overlay->previous_rect.x;
clip.y = overlay->previous_rect.y;
clip.width = overlay->previous_rect.width;
clip.height = overlay->previous_rect.height;
clutter_actor_queue_redraw_with_clip (CLUTTER_ACTOR (stage), &clip);
overlay->previous_is_valid = FALSE;
}
@@ -215,10 +215,10 @@ queue_redraw_for_overlay (MetaStage *stage,
/* Draw the overlay at the new position */
if (overlay->enabled)
{
clip.x = floorf (overlay->current_rect.origin.x),
clip.y = floorf (overlay->current_rect.origin.y),
clip.width = ceilf (overlay->current_rect.size.width),
clip.height = ceilf (overlay->current_rect.size.height),
clip.x = overlay->current_rect.x;
clip.y = overlay->current_rect.y;
clip.width = overlay->current_rect.width;
clip.height = overlay->current_rect.height;
clutter_actor_queue_redraw_with_clip (CLUTTER_ACTOR (stage), &clip);
}
}
@@ -251,10 +251,10 @@ meta_stage_remove_cursor_overlay (MetaStage *stage,
}
void
meta_stage_update_cursor_overlay (MetaStage *stage,
MetaOverlay *overlay,
CoglTexture *texture,
ClutterRect *rect)
meta_stage_update_cursor_overlay (MetaStage *stage,
MetaOverlay *overlay,
CoglTexture *texture,
MetaRectangle *rect)
{
g_assert (meta_is_wayland_compositor () || texture == NULL);

View File

@@ -56,10 +56,10 @@ MetaOverlay *meta_stage_create_cursor_overlay (MetaStage *stage);
void meta_stage_remove_cursor_overlay (MetaStage *stage,
MetaOverlay *overlay);
void meta_stage_update_cursor_overlay (MetaStage *stage,
MetaOverlay *overlay,
CoglTexture *texture,
ClutterRect *rect);
void meta_stage_update_cursor_overlay (MetaStage *stage,
MetaOverlay *overlay,
CoglTexture *texture,
MetaRectangle *rect);
void meta_stage_set_active (MetaStage *stage,
gboolean is_active);

View File

@@ -45,7 +45,6 @@
#include "backends/meta-pointer-constraint.h"
#include "backends/meta-stage.h"
#include "backends/native/meta-clutter-backend-native.h"
#include "backends/native/meta-input-settings-native.h"
#include "backends/native/meta-renderer-native.h"
#include "backends/native/meta-stage-native.h"
@@ -341,9 +340,6 @@ relative_motion_filter (ClutterInputDevice *device,
MetaLogicalMonitor *logical_monitor, *dest_logical_monitor;
float new_dx, new_dy;
if (meta_is_stage_views_scaled ())
return;
logical_monitor = meta_monitor_manager_get_logical_monitor_at (monitor_manager,
x, y);
if (!logical_monitor)
@@ -435,12 +431,6 @@ meta_backend_native_create_renderer (MetaBackend *backend)
return META_RENDERER (renderer_native);
}
static MetaInputSettings *
meta_backend_native_create_input_settings (MetaBackend *backend)
{
return g_object_new (META_TYPE_INPUT_SETTINGS_NATIVE, NULL);
}
static void
meta_backend_native_warp_pointer (MetaBackend *backend,
int x,
@@ -571,7 +561,6 @@ meta_backend_native_class_init (MetaBackendNativeClass *klass)
backend_class->create_monitor_manager = meta_backend_native_create_monitor_manager;
backend_class->create_cursor_renderer = meta_backend_native_create_cursor_renderer;
backend_class->create_renderer = meta_backend_native_create_renderer;
backend_class->create_input_settings = meta_backend_native_create_input_settings;
backend_class->warp_pointer = meta_backend_native_warp_pointer;

View File

@@ -39,7 +39,6 @@
#include "backends/meta-monitor.h"
#include "backends/meta-monitor-manager-private.h"
#include "backends/native/meta-renderer-native.h"
#include "core/boxes-private.h"
#include "meta/boxes.h"
#ifndef DRM_CAP_CURSOR_WIDTH
@@ -221,7 +220,7 @@ typedef struct
{
MetaCursorRendererNative *in_cursor_renderer_native;
MetaLogicalMonitor *in_logical_monitor;
ClutterRect in_local_cursor_rect;
MetaRectangle in_local_cursor_rect;
MetaCursorSprite *in_cursor_sprite;
gboolean out_painted;
@@ -239,50 +238,43 @@ update_monitor_crtc_cursor (MetaMonitor *monitor,
data->in_cursor_renderer_native;
MetaCursorRendererNativePrivate *priv =
meta_cursor_renderer_native_get_instance_private (cursor_renderer_native);
ClutterRect scaled_crtc_rect;
float scale;
MetaRectangle scaled_crtc_rect;
int scale;
int crtc_x, crtc_y;
if (meta_is_stage_views_scaled ())
scale = meta_logical_monitor_get_scale (data->in_logical_monitor);
else
scale = 1.0;
scale = 1;
meta_monitor_calculate_crtc_pos (monitor, monitor_mode,
monitor_crtc_mode->output,
META_MONITOR_TRANSFORM_NORMAL,
&crtc_x, &crtc_y);
scaled_crtc_rect = (ClutterRect) {
.origin = {
.x = crtc_x / scale,
.y = crtc_y / scale
},
.size = {
.width = monitor_crtc_mode->crtc_mode->width / scale,
.height = monitor_crtc_mode->crtc_mode->height / scale
},
scaled_crtc_rect = (MetaRectangle) {
.x = crtc_x / scale,
.y = crtc_y / scale,
.width = monitor_crtc_mode->crtc_mode->width / scale,
.height = monitor_crtc_mode->crtc_mode->height / scale
};
if (priv->has_hw_cursor &&
clutter_rect_intersection (&scaled_crtc_rect,
&data->in_local_cursor_rect,
NULL))
meta_rectangle_overlap (&scaled_crtc_rect,
&data->in_local_cursor_rect))
{
float crtc_cursor_x, crtc_cursor_y;
int crtc_cursor_x, crtc_cursor_y;
set_crtc_cursor (data->in_cursor_renderer_native,
monitor_crtc_mode->output->crtc,
data->in_cursor_sprite);
crtc_cursor_x = (data->in_local_cursor_rect.origin.x -
scaled_crtc_rect.origin.x) * scale;
crtc_cursor_y = (data->in_local_cursor_rect.origin.y -
scaled_crtc_rect.origin.y) * scale;
crtc_cursor_x = (data->in_local_cursor_rect.x - scaled_crtc_rect.x) * scale;
crtc_cursor_y = (data->in_local_cursor_rect.y - scaled_crtc_rect.y) * scale;
drmModeMoveCursor (priv->drm_fd,
monitor_crtc_mode->output->crtc->crtc_id,
roundf (crtc_cursor_x),
roundf (crtc_cursor_y));
crtc_cursor_x,
crtc_cursor_y);
data->out_painted = data->out_painted || TRUE;
}
@@ -306,13 +298,13 @@ update_hw_cursor (MetaCursorRendererNative *native,
meta_backend_get_monitor_manager (backend);
GList *logical_monitors;
GList *l;
ClutterRect rect;
MetaRectangle rect;
gboolean painted = FALSE;
if (cursor_sprite)
rect = meta_cursor_renderer_calculate_rect (renderer, cursor_sprite);
else
rect = (ClutterRect) { 0 };
rect = (MetaRectangle) { 0 };
logical_monitors =
meta_monitor_manager_get_logical_monitors (monitor_manager);
@@ -326,12 +318,11 @@ update_hw_cursor (MetaCursorRendererNative *native,
data = (UpdateCrtcCursorData) {
.in_cursor_renderer_native = native,
.in_logical_monitor = logical_monitor,
.in_local_cursor_rect = (ClutterRect) {
.origin = {
.x = rect.origin.x - logical_monitor->rect.x,
.y = rect.origin.y - logical_monitor->rect.y
},
.size = rect.size
.in_local_cursor_rect = (MetaRectangle) {
.x = rect.x - logical_monitor->rect.x,
.y = rect.y - logical_monitor->rect.y,
.width = rect.width,
.height = rect.height
},
.in_cursor_sprite = cursor_sprite
};
@@ -389,7 +380,7 @@ cursor_over_transformed_crtc (MetaCursorRenderer *renderer,
MetaMonitorManager *monitors;
MetaCrtc *crtcs;
unsigned int i, n_crtcs;
ClutterRect rect;
MetaRectangle rect;
monitors = meta_monitor_manager_get ();
meta_monitor_manager_get_resources (monitors, NULL, NULL,
@@ -398,13 +389,10 @@ cursor_over_transformed_crtc (MetaCursorRenderer *renderer,
for (i = 0; i < n_crtcs; i++)
{
MetaCrtc *crtc = &crtcs[i];
ClutterRect crtc_rect = meta_rectangle_to_clutter_rect (&crtc->rect);
if (!clutter_rect_intersection (&rect, &crtc_rect, NULL))
if (!meta_rectangle_overlap (&rect, &crtcs[i].rect))
continue;
if (crtc->transform != META_MONITOR_TRANSFORM_NORMAL)
if (crtcs[i].transform != META_MONITOR_TRANSFORM_NORMAL)
return TRUE;
}
@@ -425,7 +413,7 @@ can_draw_cursor_unscaled (MetaCursorRenderer *renderer,
{
MetaBackend *backend;
MetaMonitorManager *monitor_manager;
ClutterRect cursor_rect;
MetaRectangle cursor_rect;
GList *logical_monitors;
GList *l;
gboolean has_visible_crtc_sprite = FALSE;
@@ -446,12 +434,8 @@ can_draw_cursor_unscaled (MetaCursorRenderer *renderer,
for (l = logical_monitors; l; l = l->next)
{
MetaLogicalMonitor *logical_monitor = l->data;
ClutterRect logical_monitor_rect =
meta_rectangle_to_clutter_rect (&logical_monitor->rect);
if (!clutter_rect_intersection (&cursor_rect,
&logical_monitor_rect,
NULL))
if (!meta_rectangle_overlap (&cursor_rect, &logical_monitor->rect))
continue;
if (calculate_cursor_crtc_sprite_scale (cursor_sprite,

View File

@@ -121,25 +121,6 @@ meta_input_settings_native_set_tap_enabled (MetaInputSettings *settings,
LIBINPUT_CONFIG_TAP_DISABLED);
}
static void
meta_input_settings_native_set_disable_while_typing (MetaInputSettings *settings,
ClutterInputDevice *device,
gboolean enabled)
{
struct libinput_device *libinput_device;
libinput_device = clutter_evdev_input_device_get_libinput_device (device);
if (!libinput_device)
return;
if (libinput_device_config_dwt_is_available (libinput_device))
libinput_device_config_dwt_set_enabled (libinput_device,
enabled ?
LIBINPUT_CONFIG_DWT_ENABLED :
LIBINPUT_CONFIG_DWT_DISABLED);
}
static void
meta_input_settings_native_set_invert_scroll (MetaInputSettings *settings,
ClutterInputDevice *device,
@@ -451,18 +432,8 @@ meta_input_settings_native_set_tablet_area (MetaInputSettings *settings,
gdouble padding_bottom)
{
struct libinput_device *libinput_device;
gfloat scale_x;
gfloat scale_y;
gfloat offset_x;
gfloat offset_y;
scale_x = 1. / (1. - (padding_left + padding_right));
scale_y = 1. / (1. - (padding_top + padding_bottom));
offset_x = -padding_left * scale_x;
offset_y = -padding_top * scale_y;
gfloat matrix[6] = { scale_x, 0., offset_x,
0., scale_y, offset_y };
gfloat matrix[6] = { 1. - (padding_left + padding_right), 0., padding_left,
0., 1. - (padding_top + padding_bottom), padding_top };
libinput_device = clutter_evdev_input_device_get_libinput_device (device);
if (!libinput_device ||
@@ -536,7 +507,6 @@ meta_input_settings_native_class_init (MetaInputSettingsNativeClass *klass)
input_settings_class->set_scroll_button = meta_input_settings_native_set_scroll_button;
input_settings_class->set_click_method = meta_input_settings_native_set_click_method;
input_settings_class->set_keyboard_repeat = meta_input_settings_native_set_keyboard_repeat;
input_settings_class->set_disable_while_typing = meta_input_settings_native_set_disable_while_typing;
input_settings_class->set_tablet_mapping = meta_input_settings_native_set_tablet_mapping;
input_settings_class->set_tablet_keep_aspect = meta_input_settings_native_set_tablet_keep_aspect;

View File

@@ -188,22 +188,9 @@ on_evdev_device_open (const char *path,
/* Allow readonly access to sysfs */
if (g_str_has_prefix (path, "/sys/"))
{
do
{
fd = open (path, flags);
}
while (fd < 0 && errno == EINTR);
if (fd < 0)
{
g_set_error (error,
G_FILE_ERROR,
g_file_error_from_errno (errno),
"Could not open /sys file: %s: %m", path);
return -1;
}
g_hash_table_add (self->sysfs_fds, GINT_TO_POINTER (fd));
fd = open (path, flags);
if (fd >= 0)
g_hash_table_add (self->sysfs_fds, GINT_TO_POINTER (fd));
return fd;
}

View File

@@ -52,6 +52,11 @@
#define ALL_TRANSFORMS_MASK ((1 << ALL_TRANSFORMS) - 1)
#define SYNC_TOLERANCE 0.01 /* 1 percent */
static float supported_scales_kms[] = {
1.0,
2.0
};
typedef struct
{
drmModeConnector *connector;
@@ -110,6 +115,8 @@ struct _MetaMonitorManagerKms
GUdevClient *udev;
guint uevent_handler_id;
GSettings *desktop_settings;
gboolean page_flips_not_supported;
int max_buffer_width;
@@ -1254,16 +1261,9 @@ meta_monitor_manager_kms_ensure_initial_config (MetaMonitorManager *manager)
config = meta_monitor_manager_ensure_configured (manager);
if (meta_is_monitor_config_manager_enabled ())
{
meta_monitor_manager_update_logical_state (manager, config);
}
meta_monitor_manager_update_logical_state (manager, config);
else
{
MetaMonitorManagerDeriveFlag flags =
META_MONITOR_MANAGER_DERIVE_FLAG_NONE;
meta_monitor_manager_update_logical_state_derived (manager, flags);
}
meta_monitor_manager_update_logical_state_derived (manager);
}
static void
@@ -1494,13 +1494,10 @@ meta_monitor_manager_kms_apply_configuration (MetaMonitorManager *manager,
MetaOutputInfo **outputs,
unsigned int n_outputs)
{
MetaMonitorManagerDeriveFlag flags =
META_MONITOR_MANAGER_DERIVE_FLAG_NONE;
apply_crtc_assignments (manager, crtcs, n_crtcs, outputs, n_outputs);
legacy_calculate_screen_size (manager);
meta_monitor_manager_rebuild_derived (manager, flags);
meta_monitor_manager_rebuild_derived (manager);
}
static void
@@ -1642,6 +1639,8 @@ meta_monitor_manager_kms_init (MetaMonitorManagerKms *manager_kms)
G_IO_IN | G_IO_ERR);
manager_kms->source->manager_kms = manager_kms;
g_source_attach (source, NULL);
manager_kms->desktop_settings = g_settings_new ("org.gnome.desktop.interface");
}
static void
@@ -1833,50 +1832,113 @@ meta_monitor_manager_kms_is_transform_handled (MetaMonitorManager *manager,
return FALSE;
}
static float
/* The minimum resolution at which we turn on a window-scale of 2 */
#define HIDPI_LIMIT 192
/* The minimum screen height at which we turn on a window-scale of 2;
* below this there just isn't enough vertical real estate for GNOME
* apps to work, and it's better to just be tiny */
#define HIDPI_MIN_HEIGHT 1200
/* From http://en.wikipedia.org/wiki/4K_resolution#Resolutions_of_common_formats */
#define SMALLEST_4K_WIDTH 3656
static int
compute_scale (MetaMonitor *monitor,
MetaMonitorMode *monitor_mode)
{
int resolution_width, resolution_height;
int width_mm, height_mm;
int scale;
scale = 1;
meta_monitor_mode_get_resolution (monitor_mode,
&resolution_width,
&resolution_height);
if (resolution_height < HIDPI_MIN_HEIGHT)
goto out;
/* 4K TV */
switch (meta_monitor_get_connector_type (monitor))
{
case META_CONNECTOR_TYPE_HDMIA:
case META_CONNECTOR_TYPE_HDMIB:
if (resolution_width >= SMALLEST_4K_WIDTH)
goto out;
break;
default:
break;
}
meta_monitor_get_physical_dimensions (monitor, &width_mm, &height_mm);
/*
* Somebody encoded the aspect ratio (16/9 or 16/10) instead of the physical
* size.
*/
if ((width_mm == 160 && height_mm == 90) ||
(width_mm == 160 && height_mm == 100) ||
(width_mm == 16 && height_mm == 9) ||
(width_mm == 16 && height_mm == 10))
goto out;
if (width_mm > 0 && height_mm > 0)
{
double dpi_x, dpi_y;
dpi_x = (double) resolution_width / (width_mm / 25.4);
dpi_y = (double) resolution_height / (height_mm / 25.4);
/*
* We don't completely trust these values so both must be high, and never
* pick higher ratio than 2 automatically.
*/
if (dpi_x > HIDPI_LIMIT && dpi_y > HIDPI_LIMIT)
scale = 2;
}
out:
return scale;
}
static int
meta_monitor_manager_kms_calculate_monitor_mode_scale (MetaMonitorManager *manager,
MetaMonitor *monitor,
MetaMonitorMode *monitor_mode)
{
return meta_monitor_calculate_mode_scale (monitor, monitor_mode);
MetaMonitorManagerKms *manager_kms = META_MONITOR_MANAGER_KMS (manager);
int global_scale;
global_scale = g_settings_get_uint (manager_kms->desktop_settings,
"scaling-factor");
if (global_scale > 0)
return global_scale;
else
return compute_scale (monitor, monitor_mode);
}
static float *
meta_monitor_manager_kms_calculate_supported_scales (MetaMonitorManager *manager,
MetaLogicalMonitorLayoutMode layout_mode,
MetaMonitor *monitor,
MetaMonitorMode *monitor_mode,
int *n_supported_scales)
static void
meta_monitor_manager_kms_get_supported_scales (MetaMonitorManager *manager,
float **scales,
int *n_scales)
{
MetaMonitorScalesConstraint constraints =
META_MONITOR_SCALES_CONSTRAINT_NONE;
switch (layout_mode)
{
case META_LOGICAL_MONITOR_LAYOUT_MODE_LOGICAL:
break;
case META_LOGICAL_MONITOR_LAYOUT_MODE_PHYSICAL:
constraints |= META_MONITOR_SCALES_CONSTRAINT_NO_FRAC;
break;
}
return meta_monitor_calculate_supported_scales (monitor, monitor_mode,
constraints,
n_supported_scales);
*scales = supported_scales_kms;
*n_scales = G_N_ELEMENTS (supported_scales_kms);
}
static MetaMonitorManagerCapability
meta_monitor_manager_kms_get_capabilities (MetaMonitorManager *manager)
{
MetaBackend *backend = meta_get_backend ();
MetaSettings *settings = meta_backend_get_settings (backend);
MetaRenderer *renderer = meta_backend_get_renderer (backend);
MetaRendererNative *renderer_native = META_RENDERER_NATIVE (renderer);
MetaMonitorManagerCapability capabilities =
META_MONITOR_MANAGER_CAPABILITY_NONE;
if (meta_settings_is_experimental_feature_enabled (
settings,
if (meta_backend_is_experimental_feature_enabled (
backend,
META_EXPERIMENTAL_FEATURE_SCALE_MONITOR_FRAMEBUFFER))
capabilities |= META_MONITOR_MANAGER_CAPABILITY_LAYOUT_MODE;
@@ -1913,14 +1975,11 @@ meta_monitor_manager_kms_get_max_screen_size (MetaMonitorManager *manager,
static MetaLogicalMonitorLayoutMode
meta_monitor_manager_kms_get_default_layout_mode (MetaMonitorManager *manager)
{
MetaBackend *backend = meta_get_backend ();
MetaSettings *settings = meta_backend_get_settings (backend);
if (!meta_is_stage_views_enabled ())
return META_LOGICAL_MONITOR_LAYOUT_MODE_PHYSICAL;
if (meta_settings_is_experimental_feature_enabled (
settings,
if (meta_backend_is_experimental_feature_enabled (
meta_get_backend (),
META_EXPERIMENTAL_FEATURE_SCALE_MONITOR_FRAMEBUFFER))
return META_LOGICAL_MONITOR_LAYOUT_MODE_LOGICAL;
else
@@ -1933,6 +1992,7 @@ meta_monitor_manager_kms_dispose (GObject *object)
MetaMonitorManagerKms *manager_kms = META_MONITOR_MANAGER_KMS (object);
g_clear_object (&manager_kms->udev);
g_clear_object (&manager_kms->desktop_settings);
G_OBJECT_CLASS (meta_monitor_manager_kms_parent_class)->dispose (object);
}
@@ -1967,7 +2027,7 @@ meta_monitor_manager_kms_class_init (MetaMonitorManagerKmsClass *klass)
manager_class->set_crtc_gamma = meta_monitor_manager_kms_set_crtc_gamma;
manager_class->is_transform_handled = meta_monitor_manager_kms_is_transform_handled;
manager_class->calculate_monitor_mode_scale = meta_monitor_manager_kms_calculate_monitor_mode_scale;
manager_class->calculate_supported_scales = meta_monitor_manager_kms_calculate_supported_scales;
manager_class->get_supported_scales = meta_monitor_manager_kms_get_supported_scales;
manager_class->get_capabilities = meta_monitor_manager_kms_get_capabilities;
manager_class->get_max_screen_size = meta_monitor_manager_kms_get_max_screen_size;
manager_class->get_default_layout_mode = meta_monitor_manager_kms_get_default_layout_mode;

View File

@@ -1707,7 +1707,7 @@ meta_renderer_native_create_view (MetaRenderer *renderer,
MetaMonitorTransform view_transform;
CoglOnscreen *onscreen = NULL;
CoglOffscreen *offscreen = NULL;
float scale;
int scale;
int width, height;
MetaRendererView *view;
GError *error = NULL;
@@ -1715,9 +1715,9 @@ meta_renderer_native_create_view (MetaRenderer *renderer,
view_transform = calculate_view_transform (monitor_manager, logical_monitor);
if (meta_is_stage_views_scaled ())
scale = meta_logical_monitor_get_scale (logical_monitor);
scale = logical_monitor->scale;
else
scale = 1.0;
scale = 1;
width = logical_monitor->rect.width * scale;
height = logical_monitor->rect.height * scale;
@@ -2070,23 +2070,16 @@ meta_renderer_native_initable_init (GInitable *initable,
GError *egl_device_error = NULL;
#endif
#ifdef HAVE_EGL_DEVICE
/* Try to initialize the EGLDevice backend first. Whenever we use a
* non-NVIDIA GPU, the EGLDevice enumeration function won't find a match, and
* we'll fall back to GBM (which will always succeed as it has a software
* rendering fallback)
*/
if (init_egl_device (renderer_native, &egl_device_error))
return TRUE;
#endif
if (init_gbm (renderer_native, &gbm_error))
{
return TRUE;
#ifdef HAVE_EGL_DEVICE
g_error_free (egl_device_error);
#endif
if (init_egl_device (renderer_native, &egl_device_error))
{
g_error_free (gbm_error);
return TRUE;
}
#endif
g_set_error (error, G_IO_ERROR,
G_IO_ERROR_FAILED,

View File

@@ -28,7 +28,6 @@
#include "backends/meta-backend-private.h"
#include "backends/x11/meta-cursor-renderer-x11.h"
#include "backends/x11/meta-input-settings-x11.h"
#include "backends/x11/meta-monitor-manager-xrandr.h"
#include "backends/x11/cm/meta-renderer-x11-cm.h"
@@ -109,12 +108,6 @@ meta_backend_x11_cm_create_cursor_renderer (MetaBackend *backend)
return g_object_new (META_TYPE_CURSOR_RENDERER_X11, NULL);
}
static MetaInputSettings *
meta_backend_x11_cm_create_input_settings (MetaBackend *backend)
{
return g_object_new (META_TYPE_INPUT_SETTINGS_X11, NULL);
}
static void
meta_backend_x11_cm_update_screen_size (MetaBackend *backend,
int width,
@@ -397,7 +390,6 @@ meta_backend_x11_cm_class_init (MetaBackendX11CmClass *klass)
backend_class->create_renderer = meta_backend_x11_cm_create_renderer;
backend_class->create_monitor_manager = meta_backend_x11_cm_create_monitor_manager;
backend_class->create_cursor_renderer = meta_backend_x11_cm_create_cursor_renderer;
backend_class->create_input_settings = meta_backend_x11_cm_create_input_settings;
backend_class->update_screen_size = meta_backend_x11_cm_update_screen_size;
backend_class->select_stage_events = meta_backend_x11_cm_select_stage_events;
backend_class->lock_layout_group = meta_backend_x11_cm_lock_layout_group;

View File

@@ -189,14 +189,9 @@ meta_input_settings_x11_set_left_handed (MetaInputSettings *settings,
ClutterInputDevice *device,
gboolean enabled)
{
ClutterInputDeviceType device_type;
guchar value;
device_type = clutter_input_device_get_device_type (device);
if (device_type == CLUTTER_TABLET_DEVICE ||
device_type == CLUTTER_PEN_DEVICE ||
device_type == CLUTTER_ERASER_DEVICE)
if (clutter_input_device_get_device_type (device) == CLUTTER_TABLET_DEVICE)
{
value = enabled ? 3 : 0;
change_property (device, "Wacom Rotation",
@@ -210,17 +205,6 @@ meta_input_settings_x11_set_left_handed (MetaInputSettings *settings,
}
}
static void
meta_input_settings_x11_set_disable_while_typing (MetaInputSettings *settings,
ClutterInputDevice *device,
gboolean enabled)
{
guchar value = (enabled) ? 1 : 0;
change_property (device, "libinput Disable While Typing Enabled",
XA_INTEGER, 8, &value, 1);
}
static void
meta_input_settings_x11_set_tap_enabled (MetaInputSettings *settings,
ClutterInputDevice *device,
@@ -551,21 +535,10 @@ meta_input_settings_x11_set_tablet_mapping (MetaInputSettings *settings,
g_warning ("Could not set tablet mapping for %s",
clutter_input_device_get_device_name (device));
}
else
{
ClutterInputDeviceMapping dev_mapping;
dev_mapping = (mapping == G_DESKTOP_TABLET_MAPPING_ABSOLUTE) ?
CLUTTER_INPUT_DEVICE_MAPPING_ABSOLUTE :
CLUTTER_INPUT_DEVICE_MAPPING_RELATIVE;
clutter_input_device_set_mapping_mode (device, dev_mapping);
}
}
static gboolean
device_query_area (ClutterInputDevice *device,
gint *x,
gint *y,
gint *width,
gint *height)
{
@@ -591,15 +564,9 @@ device_query_area (ClutterInputDevice *device,
if (valuator->type != XIValuatorClass)
continue;
if (valuator->label == abs_x)
{
*x = valuator->min;
*width = valuator->max - valuator->min;
}
*width = valuator->max - valuator->min;
else if (valuator->label == abs_y)
{
*y = valuator->min;
*height = valuator->max - valuator->min;
}
*height = valuator->max - valuator->min;
}
XIFreeDeviceInfo (info);
@@ -623,15 +590,15 @@ meta_input_settings_x11_set_tablet_area (MetaInputSettings *settings,
gdouble padding_top,
gdouble padding_bottom)
{
gint32 x, y, width, height, area[4] = { 0 };
gint32 width, height, area[4] = { 0 };
if (!device_query_area (device, &x, &y, &width, &height))
if (!device_query_area (device, &width, &height))
return;
area[0] = (width * padding_left) + x;
area[1] = (height * padding_top) + y;
area[2] = width - (width * padding_right) + x;
area[3] = height - (height * padding_bottom) + y;
area[0] = width * padding_left;
area[1] = height * padding_top;
area[2] = width - (width * padding_right);
area[2] = height - (height * padding_bottom);
update_tablet_area (settings, device, area);
}
@@ -641,9 +608,9 @@ meta_input_settings_x11_set_tablet_keep_aspect (MetaInputSettings *settings,
MetaLogicalMonitor *logical_monitor,
gboolean keep_aspect)
{
gint32 width, height, dev_x, dev_y, dev_width, dev_height, area[4] = { 0 };
gint32 width, height, dev_width, dev_height, area[4] = { 0 };
if (!device_query_area (device, &dev_x, &dev_y, &dev_width, &dev_height))
if (!device_query_area (device, &dev_width, &dev_height))
return;
if (keep_aspect)
@@ -675,10 +642,8 @@ meta_input_settings_x11_set_tablet_keep_aspect (MetaInputSettings *settings,
dev_height = dev_width / aspect_ratio;
}
area[0] = dev_x;
area[1] = dev_y;
area[2] = dev_width + dev_x;
area[3] = dev_height + dev_y;
area[2] = dev_width;
area[3] = dev_height;
update_tablet_area (settings, device, area);
}
@@ -779,7 +744,6 @@ meta_input_settings_x11_class_init (MetaInputSettingsX11Class *klass)
input_settings_class->set_speed = meta_input_settings_x11_set_speed;
input_settings_class->set_left_handed = meta_input_settings_x11_set_left_handed;
input_settings_class->set_tap_enabled = meta_input_settings_x11_set_tap_enabled;
input_settings_class->set_disable_while_typing = meta_input_settings_x11_set_disable_while_typing;
input_settings_class->set_invert_scroll = meta_input_settings_x11_set_invert_scroll;
input_settings_class->set_edge_scroll = meta_input_settings_x11_set_edge_scroll;
input_settings_class->set_two_finger_scroll = meta_input_settings_x11_set_two_finger_scroll;

View File

@@ -33,10 +33,8 @@
#include <clutter/clutter.h>
#include <X11/Xatom.h>
#include <X11/Xlibint.h>
#include <X11/extensions/Xrandr.h>
#include <X11/extensions/dpms.h>
#include <X11/extensions/extutil.h>
#include <X11/Xlib-xcb.h>
#include <xcb/randr.h>
@@ -54,6 +52,10 @@
* for the reasoning */
#define DPI_FALLBACK 96.0
static float supported_scales_xrandr[] = {
1.0
};
struct _MetaMonitorManagerXrandr
{
MetaMonitorManager parent_instance;
@@ -64,8 +66,6 @@ struct _MetaMonitorManagerXrandr
int rr_error_base;
gboolean has_randr15;
xcb_timestamp_t last_xrandr_set_timestamp;
#ifdef HAVE_XRANDR15
GHashTable *tiled_monitor_atoms;
#endif /* HAVE_XRANDR15 */
@@ -355,7 +355,7 @@ output_get_backlight_limits_xrandr (MetaMonitorManagerXrandr *manager_xrandr,
{
Atom atom;
xcb_connection_t *xcb_conn;
g_autofree xcb_randr_query_output_property_reply_t *reply = NULL;
g_autofree xcb_randr_query_output_property_reply_t *reply;
atom = XInternAtom (manager_xrandr->xdisplay, "Backlight", False);
@@ -978,27 +978,27 @@ meta_monitor_manager_xrandr_set_power_save_mode (MetaMonitorManager *manager,
DPMSSetTimeouts (manager_xrandr->xdisplay, 0, 0, 0);
}
static xcb_randr_rotation_t
static Rotation
meta_monitor_transform_to_xrandr (MetaMonitorTransform transform)
{
switch (transform)
{
case META_MONITOR_TRANSFORM_NORMAL:
return XCB_RANDR_ROTATION_ROTATE_0;
return RR_Rotate_0;
case META_MONITOR_TRANSFORM_90:
return XCB_RANDR_ROTATION_ROTATE_90;
return RR_Rotate_90;
case META_MONITOR_TRANSFORM_180:
return XCB_RANDR_ROTATION_ROTATE_180;
return RR_Rotate_180;
case META_MONITOR_TRANSFORM_270:
return XCB_RANDR_ROTATION_ROTATE_270;
return RR_Rotate_270;
case META_MONITOR_TRANSFORM_FLIPPED:
return XCB_RANDR_ROTATION_REFLECT_X | XCB_RANDR_ROTATION_ROTATE_0;
return RR_Reflect_X | RR_Rotate_0;
case META_MONITOR_TRANSFORM_FLIPPED_90:
return XCB_RANDR_ROTATION_REFLECT_X | XCB_RANDR_ROTATION_ROTATE_90;
return RR_Reflect_X | RR_Rotate_90;
case META_MONITOR_TRANSFORM_FLIPPED_180:
return XCB_RANDR_ROTATION_REFLECT_X | XCB_RANDR_ROTATION_ROTATE_180;
return RR_Reflect_X | RR_Rotate_180;
case META_MONITOR_TRANSFORM_FLIPPED_270:
return XCB_RANDR_ROTATION_REFLECT_X | XCB_RANDR_ROTATION_ROTATE_270;
return RR_Reflect_X | RR_Rotate_270;
}
g_assert_not_reached ();
@@ -1067,180 +1067,8 @@ output_set_underscanning_xrandr (MetaMonitorManagerXrandr *manager_xrandr,
}
}
static gboolean
xrandr_set_crtc_config (MetaMonitorManagerXrandr *manager_xrandr,
gboolean save_timestamp,
xcb_randr_crtc_t crtc,
xcb_timestamp_t timestamp,
int x,
int y,
xcb_randr_mode_t mode,
xcb_randr_rotation_t rotation,
xcb_randr_output_t *outputs,
int n_outputs)
{
xcb_connection_t *xcb_conn;
xcb_timestamp_t config_timestamp;
xcb_randr_set_crtc_config_cookie_t cookie;
xcb_randr_set_crtc_config_reply_t *reply;
xcb_generic_error_t *xcb_error = NULL;
xcb_conn = XGetXCBConnection (manager_xrandr->xdisplay);
config_timestamp = manager_xrandr->resources->configTimestamp;
cookie = xcb_randr_set_crtc_config (xcb_conn,
crtc,
timestamp,
config_timestamp,
x, y,
mode,
rotation,
n_outputs,
outputs);
reply = xcb_randr_set_crtc_config_reply (xcb_conn,
cookie,
&xcb_error);
if (xcb_error || !reply)
{
free (xcb_error);
free (reply);
return FALSE;
}
if (save_timestamp)
manager_xrandr->last_xrandr_set_timestamp = reply->timestamp;
free (reply);
return TRUE;
}
static gboolean
is_crtc_assignment_changed (MetaCrtc *crtc,
MetaCrtcInfo **crtc_infos,
unsigned int n_crtc_infos)
{
unsigned int i;
for (i = 0; i < n_crtc_infos; i++)
{
MetaCrtcInfo *crtc_info = crtc_infos[i];
unsigned int j;
if (crtc_info->crtc != crtc)
continue;
if (crtc->current_mode != crtc_info->mode)
return TRUE;
if (crtc->rect.x != crtc_info->x)
return TRUE;
if (crtc->rect.y != crtc_info->y)
return TRUE;
if (crtc->transform != crtc_info->transform)
return TRUE;
for (j = 0; j < crtc_info->outputs->len; j++)
{
MetaOutput *output = ((MetaOutput**) crtc_info->outputs->pdata)[j];
if (output->crtc != crtc)
return TRUE;
}
return FALSE;
}
return crtc->current_mode != NULL;
}
static gboolean
is_output_assignment_changed (MetaOutput *output,
MetaCrtcInfo **crtc_infos,
unsigned int n_crtc_infos,
MetaOutputInfo **output_infos,
unsigned int n_output_infos)
{
gboolean output_is_found = FALSE;
unsigned int i;
for (i = 0; i < n_output_infos; i++)
{
MetaOutputInfo *output_info = output_infos[i];
if (output_info->output != output)
continue;
if (output->is_primary != output_info->is_primary)
return TRUE;
if (output->is_presentation != output_info->is_presentation)
return TRUE;
if (output->is_underscanning != output_info->is_underscanning)
return TRUE;
output_is_found = TRUE;
}
if (!output_is_found)
return output->crtc != NULL;
for (i = 0; i < n_crtc_infos; i++)
{
MetaCrtcInfo *crtc_info = crtc_infos[i];
unsigned int j;
for (j = 0; j < crtc_info->outputs->len; j++)
{
MetaOutput *crtc_info_output =
((MetaOutput**) crtc_info->outputs->pdata)[j];
if (crtc_info_output == output &&
crtc_info->crtc == output->crtc)
return FALSE;
}
}
return TRUE;
}
static gboolean
is_assignments_changed (MetaMonitorManager *manager,
MetaCrtcInfo **crtc_infos,
unsigned int n_crtc_infos,
MetaOutputInfo **output_infos,
unsigned int n_output_infos)
{
unsigned int i;
for (i = 0; i < manager->n_crtcs; i++)
{
MetaCrtc *crtc = &manager->crtcs[i];
if (is_crtc_assignment_changed (crtc, crtc_infos, n_crtc_infos))
return TRUE;
}
for (i = 0; i < manager->n_outputs; i++)
{
MetaOutput *output = &manager->outputs[i];
if (is_output_assignment_changed (output,
crtc_infos,
n_crtc_infos,
output_infos,
n_output_infos))
return TRUE;
}
return FALSE;
}
static void
apply_crtc_assignments (MetaMonitorManager *manager,
gboolean save_timestamp,
MetaCrtcInfo **crtcs,
unsigned int n_crtcs,
MetaOutputInfo **outputs,
@@ -1289,13 +1117,14 @@ apply_crtc_assignments (MetaMonitorManager *manager,
crtc->rect.x + crtc->rect.width > width ||
crtc->rect.y + crtc->rect.height > height)
{
xrandr_set_crtc_config (manager_xrandr,
save_timestamp,
(xcb_randr_crtc_t) crtc->crtc_id,
XCB_CURRENT_TIME,
0, 0, XCB_NONE,
XCB_RANDR_ROTATION_ROTATE_0,
NULL, 0);
XRRSetCrtcConfig (manager_xrandr->xdisplay,
manager_xrandr->resources,
(XID)crtc->crtc_id,
CurrentTime,
0, 0,
None,
RR_Rotate_0,
NULL, 0);
crtc->rect.x = 0;
crtc->rect.y = 0;
@@ -1318,13 +1147,14 @@ apply_crtc_assignments (MetaMonitorManager *manager,
if (crtc->current_mode == NULL)
continue;
xrandr_set_crtc_config (manager_xrandr,
save_timestamp,
(xcb_randr_crtc_t) crtc->crtc_id,
XCB_CURRENT_TIME,
0, 0, XCB_NONE,
XCB_RANDR_ROTATION_ROTATE_0,
NULL, 0);
XRRSetCrtcConfig (manager_xrandr->xdisplay,
manager_xrandr->resources,
(XID)crtc->crtc_id,
CurrentTime,
0, 0,
None,
RR_Rotate_0,
NULL, 0);
crtc->rect.x = 0;
crtc->rect.y = 0;
@@ -1353,14 +1183,14 @@ apply_crtc_assignments (MetaMonitorManager *manager,
if (crtc_info->mode != NULL)
{
MetaCrtcMode *mode;
g_autofree xcb_randr_output_t *output_ids = NULL;
g_autofree XID *output_ids = NULL;
unsigned int j, n_output_ids;
xcb_randr_rotation_t rotation;
Status ok;
mode = crtc_info->mode;
n_output_ids = crtc_info->outputs->len;
output_ids = g_new (xcb_randr_output_t, n_output_ids);
output_ids = g_new (XID, n_output_ids);
for (j = 0; j < n_output_ids; j++)
{
@@ -1374,15 +1204,16 @@ apply_crtc_assignments (MetaMonitorManager *manager,
output_ids[j] = output->winsys_id;
}
rotation = meta_monitor_transform_to_xrandr (crtc_info->transform);
if (!xrandr_set_crtc_config (manager_xrandr,
save_timestamp,
(xcb_randr_crtc_t) crtc->crtc_id,
XCB_CURRENT_TIME,
crtc_info->x, crtc_info->y,
(xcb_randr_mode_t) mode->mode_id,
rotation,
output_ids, n_output_ids))
ok = XRRSetCrtcConfig (manager_xrandr->xdisplay,
manager_xrandr->resources,
(XID)crtc->crtc_id,
CurrentTime,
crtc_info->x, crtc_info->y,
(XID)mode->mode_id,
meta_monitor_transform_to_xrandr (crtc_info->transform),
output_ids, n_output_ids);
if (ok != Success)
{
meta_warning ("Configuring CRTC %d with mode %d (%d x %d @ %f) at position %d, %d and transform %u failed\n",
(unsigned)(crtc->crtc_id), (unsigned)(mode->mode_id),
@@ -1459,9 +1290,6 @@ apply_crtc_assignments (MetaMonitorManager *manager,
static void
meta_monitor_manager_xrandr_ensure_initial_config (MetaMonitorManager *manager)
{
MetaMonitorManagerDeriveFlag flags =
META_MONITOR_MANAGER_DERIVE_FLAG_NONE;
meta_monitor_manager_ensure_configured (manager);
/*
@@ -1471,10 +1299,7 @@ meta_monitor_manager_xrandr_ensure_initial_config (MetaMonitorManager *manager)
*/
meta_monitor_manager_read_current_state (manager);
if (meta_is_monitor_config_manager_enabled ())
flags |= META_MONITOR_MANAGER_DERIVE_FLAG_CONFIGURED_SCALE;
meta_monitor_manager_update_logical_state_derived (manager, flags);
meta_monitor_manager_update_logical_state_derived (manager);
}
static gboolean
@@ -1488,10 +1313,7 @@ meta_monitor_manager_xrandr_apply_monitors_config (MetaMonitorManager *mana
if (!config)
{
MetaMonitorManagerDeriveFlag flags =
META_MONITOR_MANAGER_DERIVE_FLAG_NONE;
meta_monitor_manager_rebuild_derived (manager, flags);
meta_monitor_manager_rebuild_derived (manager);
return TRUE;
}
@@ -1502,35 +1324,11 @@ meta_monitor_manager_xrandr_apply_monitors_config (MetaMonitorManager *mana
if (method != META_MONITORS_CONFIG_METHOD_VERIFY)
{
/*
* If the assignment has not changed, we won't get any notification about
* any new configuration from the X server; but we still need to update
* our own configuration, as something not applicable in Xrandr might
* have changed locally, such as the logical monitors scale. This means we
* must check that our new assignment actually changes anything, otherwise
* just update the logical state.
*/
if (is_assignments_changed (manager,
(MetaCrtcInfo **) crtc_infos->pdata,
crtc_infos->len,
(MetaOutputInfo **) output_infos->pdata,
output_infos->len))
{
apply_crtc_assignments (manager,
TRUE,
(MetaCrtcInfo **) crtc_infos->pdata,
crtc_infos->len,
(MetaOutputInfo **) output_infos->pdata,
output_infos->len);
}
else
{
MetaMonitorManagerDeriveFlag flags;
flags = (META_MONITOR_MANAGER_DERIVE_FLAG_NONE |
META_MONITOR_MANAGER_DERIVE_FLAG_CONFIGURED_SCALE);
meta_monitor_manager_rebuild_derived (manager, flags);
}
apply_crtc_assignments (manager,
(MetaCrtcInfo **) crtc_infos->pdata,
crtc_infos->len,
(MetaOutputInfo **) output_infos->pdata,
output_infos->len);
}
g_ptr_array_free (crtc_infos, TRUE);
@@ -1546,7 +1344,7 @@ meta_monitor_manager_xrandr_apply_configuration (MetaMonitorManager *manager,
MetaOutputInfo **outputs,
unsigned int n_outputs)
{
apply_crtc_assignments (manager, FALSE, crtcs, n_crtcs, outputs, n_outputs);
apply_crtc_assignments (manager, crtcs, n_crtcs, outputs, n_outputs);
}
static void
@@ -1787,34 +1585,28 @@ meta_monitor_manager_xrandr_is_transform_handled (MetaMonitorManager *manager,
return TRUE;
}
static float
static int
meta_monitor_manager_xrandr_calculate_monitor_mode_scale (MetaMonitorManager *manager,
MetaMonitor *monitor,
MetaMonitorMode *monitor_mode)
{
return meta_monitor_calculate_mode_scale (monitor, monitor_mode);
/* X11 does not support anything other than scale 1. */
return 1;
}
static float *
meta_monitor_manager_xrandr_calculate_supported_scales (MetaMonitorManager *manager,
MetaLogicalMonitorLayoutMode layout_mode,
MetaMonitor *monitor,
MetaMonitorMode *monitor_mode,
int *n_supported_scales)
static void
meta_monitor_manager_xrandr_get_supported_scales (MetaMonitorManager *manager,
float **scales,
int *n_scales)
{
MetaMonitorScalesConstraint constraints;
constraints = META_MONITOR_SCALES_CONSTRAINT_NO_FRAC;
return meta_monitor_calculate_supported_scales (monitor, monitor_mode,
constraints,
n_supported_scales);
*scales = supported_scales_xrandr;
*n_scales = G_N_ELEMENTS (supported_scales_xrandr);
}
static MetaMonitorManagerCapability
meta_monitor_manager_xrandr_get_capabilities (MetaMonitorManager *manager)
{
return (META_MONITOR_MANAGER_CAPABILITY_MIRRORING |
META_MONITOR_MANAGER_CAPABILITY_GLOBAL_SCALE_REQUIRED);
return META_MONITOR_MANAGER_CAPABILITY_MIRRORING;
}
static gboolean
@@ -1834,7 +1626,11 @@ meta_monitor_manager_xrandr_get_max_screen_size (MetaMonitorManager *manager,
static MetaLogicalMonitorLayoutMode
meta_monitor_manager_xrandr_get_default_layout_mode (MetaMonitorManager *manager)
{
return META_LOGICAL_MONITOR_LAYOUT_MODE_PHYSICAL;
/*
* Under X11, we still use the 'logical' layout mode, but it is
* eqivalent to 'physical' as the scale is always 1.
*/
return META_LOGICAL_MONITOR_LAYOUT_MODE_LOGICAL;
}
static void
@@ -1914,7 +1710,7 @@ meta_monitor_manager_xrandr_class_init (MetaMonitorManagerXrandrClass *klass)
#endif
manager_class->is_transform_handled = meta_monitor_manager_xrandr_is_transform_handled;
manager_class->calculate_monitor_mode_scale = meta_monitor_manager_xrandr_calculate_monitor_mode_scale;
manager_class->calculate_supported_scales = meta_monitor_manager_xrandr_calculate_supported_scales;
manager_class->get_supported_scales = meta_monitor_manager_xrandr_get_supported_scales;
manager_class->get_capabilities = meta_monitor_manager_xrandr_get_capabilities;
manager_class->get_max_screen_size = meta_monitor_manager_xrandr_get_max_screen_size;
manager_class->get_default_layout_mode = meta_monitor_manager_xrandr_get_default_layout_mode;
@@ -1928,8 +1724,7 @@ meta_monitor_manager_xrandr_handle_xevent (MetaMonitorManagerXrandr *manager_xra
XEvent *event)
{
MetaMonitorManager *manager = META_MONITOR_MANAGER (manager_xrandr);
gboolean is_hotplug;
gboolean is_our_configuration;
gboolean hotplug;
if ((event->type - manager_xrandr->rr_event_base) != RRScreenChangeNotify)
return FALSE;
@@ -1938,24 +1733,16 @@ meta_monitor_manager_xrandr_handle_xevent (MetaMonitorManagerXrandr *manager_xra
meta_monitor_manager_read_current_state (manager);
is_hotplug = (manager_xrandr->resources->timestamp <
manager_xrandr->resources->configTimestamp);
is_our_configuration = (manager_xrandr->resources->timestamp ==
manager_xrandr->last_xrandr_set_timestamp);
if (is_hotplug)
hotplug = manager_xrandr->resources->timestamp < manager_xrandr->resources->configTimestamp;
if (hotplug)
{
/* This is a hotplug event, so go ahead and build a new configuration. */
meta_monitor_manager_on_hotplug (manager);
}
else
{
MetaMonitorManagerDeriveFlag flags =
META_MONITOR_MANAGER_DERIVE_FLAG_NONE;
if (is_our_configuration)
flags |= META_MONITOR_MANAGER_DERIVE_FLAG_CONFIGURED_SCALE;
meta_monitor_manager_rebuild_derived (manager, flags);
/* Something else changed -- tell the world about it. */
meta_monitor_manager_rebuild_derived (manager);
}
return TRUE;

View File

@@ -49,12 +49,6 @@ meta_backend_x11_nested_create_cursor_renderer (MetaBackend *backend)
return g_object_new (META_TYPE_CURSOR_RENDERER_X11_NESTED, NULL);
}
static MetaInputSettings *
meta_backend_x11_nested_create_input_settings (MetaBackend *backend)
{
return NULL;
}
static void
meta_backend_x11_nested_update_screen_size (MetaBackend *backend,
int width,
@@ -183,7 +177,6 @@ meta_backend_x11_nested_class_init (MetaBackendX11NestedClass *klass)
backend_class->create_renderer = meta_backend_x11_nested_create_renderer;
backend_class->create_monitor_manager = meta_backend_x11_nested_create_monitor_manager;
backend_class->create_cursor_renderer = meta_backend_x11_nested_create_cursor_renderer;
backend_class->create_input_settings = meta_backend_x11_nested_create_input_settings;
backend_class->update_screen_size = meta_backend_x11_nested_update_screen_size;
backend_class->select_stage_events = meta_backend_x11_nested_select_stage_events;
backend_class->lock_layout_group = meta_backend_x11_nested_lock_layout_group;

View File

@@ -173,7 +173,7 @@ meta_renderer_x11_nested_create_view (MetaRenderer *renderer,
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend);
MetaMonitorTransform view_transform;
float view_scale;
int view_scale;
int width, height;
CoglOffscreen *fake_onscreen;
CoglOffscreen *offscreen;
@@ -183,7 +183,7 @@ meta_renderer_x11_nested_create_view (MetaRenderer *renderer,
if (meta_is_stage_views_scaled ())
view_scale = logical_monitor->scale;
else
view_scale = 1.0;
view_scale = 1;
if (meta_monitor_transform_is_rotated (view_transform))
{

View File

@@ -155,7 +155,7 @@ file_loaded (GObject *source_object,
CoglError *catch_error = NULL;
GTask *task;
CoglTexture *texture;
GdkPixbuf *pixbuf, *rotated;
GdkPixbuf *pixbuf;
int width, height, row_stride;
guchar *pixels;
gboolean has_alpha;
@@ -173,13 +173,6 @@ file_loaded (GObject *source_object,
goto out;
}
rotated = gdk_pixbuf_apply_embedded_orientation (pixbuf);
if (rotated != NULL)
{
g_object_unref (pixbuf);
pixbuf = rotated;
}
width = gdk_pixbuf_get_width (pixbuf);
height = gdk_pixbuf_get_height (pixbuf);
row_stride = gdk_pixbuf_get_rowstride (pixbuf);

View File

@@ -220,11 +220,7 @@ meta_shadow_paint (MetaShadow *shadow,
int dest_x[4];
int dest_y[4];
int n_x, n_y;
cogl_pipeline_set_color4ub (shadow->pipeline,
opacity, opacity, opacity, opacity);
cogl_set_source (shadow->pipeline);
gboolean source_updated = FALSE;
if (shadow->scale_width)
{
@@ -300,6 +296,17 @@ meta_shadow_paint (MetaShadow *shadow,
else
overlap = CAIRO_REGION_OVERLAP_IN;
if (overlap == CAIRO_REGION_OVERLAP_OUT)
continue;
if (!source_updated)
{
cogl_pipeline_set_color4ub (shadow->pipeline,
opacity, opacity, opacity, opacity);
cogl_set_source (shadow->pipeline);
source_updated = TRUE;
}
/* There's quite a bit of overhead from allocating a new
* region in order to find an exact intersection and
* generating more geometry - we make the assumption that

View File

@@ -35,7 +35,6 @@ G_DEFINE_ABSTRACT_TYPE_WITH_CODE (MetaSurfaceActor, meta_surface_actor, CLUTTER_
G_IMPLEMENT_INTERFACE (META_TYPE_CULLABLE, cullable_iface_init));
enum {
REPAINT_SCHEDULED,
SIZE_CHANGED,
LAST_SIGNAL,
@@ -121,13 +120,6 @@ meta_surface_actor_class_init (MetaSurfaceActorClass *klass)
object_class->dispose = meta_surface_actor_dispose;
actor_class->pick = meta_surface_actor_pick;
signals[REPAINT_SCHEDULED] = g_signal_new ("repaint-scheduled",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
G_TYPE_NONE, 0);
signals[SIZE_CHANGED] = g_signal_new ("size-changed",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
@@ -201,8 +193,7 @@ meta_surface_actor_update_area (MetaSurfaceActor *self,
{
MetaSurfaceActorPrivate *priv = self->priv;
if (meta_shaped_texture_update_area (priv->texture, x, y, width, height))
g_signal_emit (self, signals[REPAINT_SCHEDULED], 0);
meta_shaped_texture_update_area (priv->texture, x, y, width, height);
}
gboolean

View File

@@ -62,6 +62,6 @@ void meta_texture_tower_update_area (MetaTextureTower *tower,
int height);
CoglTexture *meta_texture_tower_get_paint_texture (MetaTextureTower *tower);
G_END_DECLS
G_BEGIN_DECLS
#endif /* __META_TEXTURE_TOWER_H__ */

View File

@@ -82,7 +82,6 @@ struct _MetaWindowActorPrivate
guint send_frame_messages_timer;
gint64 frame_drawn_time;
guint repaint_scheduled_id;
guint size_changed_id;
/*
@@ -194,6 +193,18 @@ frame_data_free (FrameData *frame)
g_slice_free (FrameData, frame);
}
static gboolean
meta_window_actor_queue_redraw (ClutterActor *actor,
ClutterActor *leaf,
ClutterPaintVolume *paint_volume)
{
MetaWindowActor *self = META_WINDOW_ACTOR (actor);
MetaWindowActorPrivate *priv = self->priv;
priv->repaint_scheduled = TRUE;
return CLUTTER_ACTOR_CLASS (meta_window_actor_parent_class)->queue_redraw (actor, leaf, paint_volume);
}
static void
meta_window_actor_class_init (MetaWindowActorClass *klass)
{
@@ -211,6 +222,7 @@ meta_window_actor_class_init (MetaWindowActorClass *klass)
actor_class->paint = meta_window_actor_paint;
actor_class->get_paint_volume = meta_window_actor_get_paint_volume;
actor_class->queue_redraw = meta_window_actor_queue_redraw;
/**
* MetaWindowActor::first-frame:
@@ -297,16 +309,6 @@ surface_size_changed (MetaSurfaceActor *actor,
meta_window_actor_update_shape (self);
}
static void
surface_repaint_scheduled (MetaSurfaceActor *actor,
gpointer user_data)
{
MetaWindowActor *self = META_WINDOW_ACTOR (user_data);
MetaWindowActorPrivate *priv = self->priv;
priv->repaint_scheduled = TRUE;
}
static gboolean
is_argb32 (MetaWindowActor *self)
{
@@ -396,9 +398,7 @@ set_surface (MetaWindowActor *self,
if (priv->surface)
{
g_signal_handler_disconnect (priv->surface, priv->repaint_scheduled_id);
g_signal_handler_disconnect (priv->surface, priv->size_changed_id);
priv->repaint_scheduled_id = 0;
clutter_actor_remove_child (CLUTTER_ACTOR (self), CLUTTER_ACTOR (priv->surface));
g_object_unref (priv->surface);
}
@@ -408,8 +408,6 @@ set_surface (MetaWindowActor *self,
if (priv->surface)
{
g_object_ref_sink (priv->surface);
priv->repaint_scheduled_id = g_signal_connect (priv->surface, "repaint-scheduled",
G_CALLBACK (surface_repaint_scheduled), self);
priv->size_changed_id = g_signal_connect (priv->surface, "size-changed",
G_CALLBACK (surface_size_changed), self);
clutter_actor_add_child (CLUTTER_ACTOR (self), CLUTTER_ACTOR (priv->surface));
@@ -717,6 +715,7 @@ meta_window_actor_paint (ClutterActor *actor)
cairo_rectangle_int_t shape_bounds;
cairo_region_t *clip = priv->shadow_clip;
MetaWindow *window = priv->window;
gboolean partially_drawn = FALSE;
meta_window_actor_get_shape_bounds (self, &shape_bounds);
meta_window_actor_get_shadow_params (self, appears_focused, &params);
@@ -734,6 +733,17 @@ meta_window_actor_paint (ClutterActor *actor)
cairo_region_subtract (clip, frame_bounds);
}
else if (clip)
{
cairo_rectangle_int_t shadow_bounds;
cairo_region_t *shadow_region;
meta_window_actor_get_shadow_bounds (self, appears_focused, &shadow_bounds);
shadow_region = cairo_region_create_rectangle (&shadow_bounds);
cairo_region_intersect (shadow_region, clip);
partially_drawn = !cairo_region_is_empty (shadow_region);
cairo_region_destroy (shadow_region);
}
meta_shadow_paint (shadow,
params.x_offset + shape_bounds.x,
@@ -742,7 +752,7 @@ meta_window_actor_paint (ClutterActor *actor)
shape_bounds.height,
(clutter_actor_get_paint_opacity (actor) * params.opacity * window->opacity) / (255 * 255),
clip,
clip_shadow_under_window (self)); /* clip_strictly - not just as an optimization */
clip_shadow_under_window (self) || partially_drawn);
if (clip && clip != priv->shadow_clip)
cairo_region_destroy (clip);

View File

@@ -57,7 +57,7 @@ meta_window_group_paint (ClutterActor *actor)
{
cairo_region_t *clip_region;
cairo_region_t *unobscured_region;
cairo_rectangle_int_t visible_rect, clip_rect;
cairo_rectangle_int_t visible_rect;
int paint_x_origin, paint_y_origin;
int screen_width, screen_height;
@@ -109,11 +109,7 @@ meta_window_group_paint (ClutterActor *actor)
* sizes, we could intersect this with an accurate union of the
* monitors to avoid painting shadows that are visible only in the
* holes. */
clutter_stage_get_redraw_clip_bounds (CLUTTER_STAGE (stage),
&clip_rect);
clip_region = cairo_region_create_rectangle (&clip_rect);
clip_region = clutter_stage_get_redraw_clip (CLUTTER_STAGE (stage));
cairo_region_translate (clip_region, -paint_x_origin, -paint_y_origin);
meta_cullable_cull_out (META_CULLABLE (window_group), unobscured_region, clip_region);

View File

@@ -218,19 +218,4 @@ GList* meta_rectangle_find_nonintersected_monitor_edges (
gboolean meta_rectangle_is_adjecent_to (MetaRectangle *rect,
MetaRectangle *other);
static inline ClutterRect
meta_rectangle_to_clutter_rect (MetaRectangle *rect)
{
return (ClutterRect) {
.origin = {
.x = rect->x,
.y = rect->y
},
.size = {
.width = rect->width,
.height = rect->height
}
};
}
#endif /* META_BOXES_PRIVATE_H */

View File

@@ -66,11 +66,6 @@ meta_window_set_alive (MetaWindow *window,
{
meta_window_ensure_close_dialog (window);
meta_close_dialog_show (window->close_dialog);
if (window->display &&
window->display->event_route == META_EVENT_ROUTE_NORMAL &&
window == window->display->focus_window)
meta_close_dialog_focus (window->close_dialog);
}
}

View File

@@ -963,7 +963,7 @@ meta_display_open (void)
meta_screen_init_workspaces (screen);
meta_backend_x11_display_opened (meta_get_backend ());
meta_backend_display_opened (meta_get_backend ());
enable_compositor (display);
@@ -3162,14 +3162,18 @@ meta_display_get_pad_action_label (MetaDisplay *display,
MetaPadActionType action_type,
guint action_number)
{
MetaInputSettings *settings;
gchar *label;
/* First, lookup the action, as imposed by settings */
settings = meta_backend_get_input_settings (meta_get_backend ());
label = meta_input_settings_get_pad_action_label (settings, pad, action_type, action_number);
if (label)
return label;
if (action_type == META_PAD_ACTION_BUTTON)
{
MetaInputSettings *settings;
settings = meta_backend_get_input_settings (meta_get_backend ());
label = meta_input_settings_get_pad_button_action_label (settings, pad, action_number);
if (label)
return label;
}
#ifdef HAVE_WAYLAND
/* Second, if this wayland, lookup the actions set by the clients */

View File

@@ -220,12 +220,10 @@ meta_display_handle_event (MetaDisplay *display,
if (!display->current_pad_osd &&
(event->type == CLUTTER_PAD_BUTTON_PRESS ||
event->type == CLUTTER_PAD_BUTTON_RELEASE ||
event->type == CLUTTER_PAD_RING ||
event->type == CLUTTER_PAD_STRIP))
event->type == CLUTTER_PAD_BUTTON_RELEASE))
{
if (meta_input_settings_handle_pad_event (meta_backend_get_input_settings (backend),
event))
if (meta_input_settings_handle_pad_button (meta_backend_get_input_settings (backend),
&event->pad_button))
{
bypass_wayland = bypass_clutter = TRUE;
goto out;
@@ -384,17 +382,6 @@ meta_display_handle_event (MetaDisplay *display,
XIReplayDevice, event->button.time);
}
}
/* If the focus window has an active close dialog let clutter
* events go through, so fancy clutter dialogs can get to handle
* all events.
*/
if (window->close_dialog &&
meta_close_dialog_is_visible (window->close_dialog))
{
bypass_wayland = TRUE;
bypass_clutter = FALSE;
}
}
goto out;

View File

@@ -44,8 +44,7 @@ struct _MetaKeyHandler
};
typedef struct _MetaResolvedKeyCombo {
xkb_keycode_t *keycodes;
int len;
xkb_keycode_t keycode;
xkb_mod_mask_t mask;
} MetaResolvedKeyCombo;
@@ -103,7 +102,7 @@ typedef struct
MetaKeyCombo overlay_key_combo;
MetaResolvedKeyCombo overlay_resolved_key_combo;
gboolean overlay_key_only_pressed;
MetaResolvedKeyCombo iso_next_group_combo[2];
MetaResolvedKeyCombo *iso_next_group_combos;
int n_iso_next_group_combos;
xkb_level_index_t keymap_num_levels;

View File

@@ -44,7 +44,6 @@
#define KEY_GRAVE 0x29 /* assume the use of xf86-input-keyboard */
#endif
#include "backends/meta-monitor-manager-private.h"
#include "backends/meta-logical-monitor.h"
#include "backends/x11/meta-backend-x11.h"
#include "x11/window-x11.h"
@@ -65,63 +64,16 @@ static gboolean add_builtin_keybinding (MetaDisplay *display,
MetaKeyHandlerFunc handler,
int handler_arg);
static void
resolved_key_combo_reset (MetaResolvedKeyCombo *resolved_combo)
{
g_free (resolved_combo->keycodes);
resolved_combo->len = 0;
resolved_combo->keycodes = NULL;
}
static void
resolved_key_combo_copy (MetaResolvedKeyCombo *from,
MetaResolvedKeyCombo *to)
{
to->len = from->len;
to->keycodes = g_memdup (from->keycodes,
from->len * sizeof (xkb_keycode_t));
}
static gboolean
resolved_key_combo_has_keycode (MetaResolvedKeyCombo *resolved_combo,
int keycode)
{
int i;
for (i = 0; i < resolved_combo->len; i++)
if ((int) resolved_combo->keycodes[i] == keycode)
return TRUE;
return FALSE;
}
static gboolean
resolved_key_combo_intersect (MetaResolvedKeyCombo *a,
MetaResolvedKeyCombo *b)
{
int i;
for (i = 0; i < a->len; i++)
if (resolved_key_combo_has_keycode (b, a->keycodes[i]))
return TRUE;
return FALSE;
}
static void
meta_key_binding_free (MetaKeyBinding *binding)
{
resolved_key_combo_reset (&binding->resolved_combo);
g_slice_free (MetaKeyBinding, binding);
}
static MetaKeyBinding *
meta_key_binding_copy (MetaKeyBinding *binding)
{
MetaKeyBinding *clone = g_slice_dup (MetaKeyBinding, binding);
resolved_key_combo_copy (&binding->resolved_combo,
&clone->resolved_combo);
return clone;
return g_slice_dup (MetaKeyBinding, binding);
}
G_DEFINE_BOXED_TYPE(MetaKeyBinding,
@@ -211,8 +163,7 @@ meta_key_grab_free (MetaKeyGrab *grab)
}
static guint32
key_combo_key (MetaResolvedKeyCombo *resolved_combo,
int i)
key_combo_key (MetaResolvedKeyCombo *resolved_combo)
{
/* On X, keycodes are only 8 bits while libxkbcommon supports 32 bit
keycodes, but since we're using the same XKB keymaps that X uses,
@@ -222,7 +173,7 @@ key_combo_key (MetaResolvedKeyCombo *resolved_combo,
can use a 32 bit integer to safely concatenate both keycode and
mask and thus making it easy to use them as an index in a
GHashTable. */
guint32 key = resolved_combo->keycodes[i] & 0xffff;
guint32 key = resolved_combo->keycode & 0xffff;
return (key << 16) | (resolved_combo->mask & 0xffff);
}
@@ -323,34 +274,21 @@ get_keycodes_for_keysym_iter (struct xkb_keymap *keymap,
xkb_level_index_t level = search_data->level;
if (is_keycode_for_keysym (keymap, layout, level, keycode, keysym))
{
guint i;
gboolean missing = TRUE;
/* duplicate keycode detection */
for (i = 0; i < keycodes->len; i++)
if (g_array_index (keycodes, xkb_keysym_t, i) == keycode)
{
missing = FALSE;
break;
}
if (missing)
g_array_append_val (keycodes, keycode);
}
g_array_append_val (keycodes, keycode);
}
/* Original code from gdk_x11_keymap_get_entries_for_keyval() in
* gdkkeys-x11.c */
static void
static int
get_keycodes_for_keysym (MetaKeyBindingManager *keys,
int keysym,
MetaResolvedKeyCombo *resolved_combo)
int **keycodes)
{
GArray *retval;
int n_keycodes;
int keycode;
retval = g_array_new (FALSE, FALSE, sizeof (xkb_keysym_t));
retval = g_array_new (FALSE, FALSE, sizeof (int));
/* Special-case: Fake mutter keysym */
if (keysym == META_KEY_ABOVE_TAB)
@@ -375,8 +313,28 @@ get_keycodes_for_keysym (MetaKeyBindingManager *keys,
}
out:
resolved_combo->len = retval->len;
resolved_combo->keycodes = (xkb_keycode_t *) g_array_free (retval, retval->len == 0 ? TRUE : FALSE);
n_keycodes = retval->len;
*keycodes = (int*) g_array_free (retval, n_keycodes == 0 ? TRUE : FALSE);
return n_keycodes;
}
static guint
get_first_keycode_for_keysym (MetaKeyBindingManager *keys,
guint keysym)
{
int *keycodes;
int n_keycodes;
int keycode;
n_keycodes = get_keycodes_for_keysym (keys, keysym, &keycodes);
if (n_keycodes > 0)
keycode = keycodes[0];
else
keycode = 0;
g_free (keycodes);
return keycode;
}
static void
@@ -409,23 +367,20 @@ static void
reload_iso_next_group_combos (MetaKeyBindingManager *keys)
{
const char *iso_next_group_option;
MetaResolvedKeyCombo *combos;
int *keycodes;
int n_keycodes;
int n_combos;
int i;
for (i = 0; i < keys->n_iso_next_group_combos; i++)
resolved_key_combo_reset (&keys->iso_next_group_combo[i]);
g_clear_pointer (&keys->iso_next_group_combos, g_free);
keys->n_iso_next_group_combos = 0;
iso_next_group_option = meta_prefs_get_iso_next_group_option ();
if (iso_next_group_option == NULL)
return;
get_keycodes_for_keysym (keys, XKB_KEY_ISO_Next_Group, keys->iso_next_group_combo);
if (keys->iso_next_group_combo[0].len == 0)
return;
keys->n_iso_next_group_combos = 1;
n_keycodes = get_keycodes_for_keysym (keys, XKB_KEY_ISO_Next_Group, &keycodes);
if (g_str_equal (iso_next_group_option, "toggle") ||
g_str_equal (iso_next_group_option, "lalt_toggle") ||
@@ -439,53 +394,94 @@ reload_iso_next_group_combos (MetaKeyBindingManager *keys)
g_str_equal (iso_next_group_option, "menu_toggle") ||
g_str_equal (iso_next_group_option, "caps_toggle"))
{
keys->iso_next_group_combo[0].mask = 0;
n_combos = n_keycodes;
combos = g_new (MetaResolvedKeyCombo, n_combos);
for (i = 0; i < n_keycodes; ++i)
{
combos[i].keycode = keycodes[i];
combos[i].mask = 0;
}
}
else if (g_str_equal (iso_next_group_option, "shift_caps_toggle") ||
g_str_equal (iso_next_group_option, "shifts_toggle"))
{
keys->iso_next_group_combo[0].mask = ShiftMask;
n_combos = n_keycodes;
combos = g_new (MetaResolvedKeyCombo, n_combos);
for (i = 0; i < n_keycodes; ++i)
{
combos[i].keycode = keycodes[i];
combos[i].mask = ShiftMask;
}
}
else if (g_str_equal (iso_next_group_option, "alt_caps_toggle") ||
g_str_equal (iso_next_group_option, "alt_space_toggle"))
{
keys->iso_next_group_combo[0].mask = Mod1Mask;
n_combos = n_keycodes;
combos = g_new (MetaResolvedKeyCombo, n_combos);
for (i = 0; i < n_keycodes; ++i)
{
combos[i].keycode = keycodes[i];
combos[i].mask = Mod1Mask;
}
}
else if (g_str_equal (iso_next_group_option, "ctrl_shift_toggle") ||
g_str_equal (iso_next_group_option, "lctrl_lshift_toggle") ||
g_str_equal (iso_next_group_option, "rctrl_rshift_toggle"))
{
resolved_key_combo_copy (&keys->iso_next_group_combo[0],
&keys->iso_next_group_combo[1]);
n_combos = n_keycodes * 2;
combos = g_new (MetaResolvedKeyCombo, n_combos);
keys->iso_next_group_combo[0].mask = ShiftMask;
keys->iso_next_group_combo[1].mask = ControlMask;
keys->n_iso_next_group_combos = 2;
for (i = 0; i < n_keycodes; ++i)
{
combos[i].keycode = keycodes[i];
combos[i].mask = ShiftMask;
combos[i + n_keycodes].keycode = keycodes[i];
combos[i + n_keycodes].mask = ControlMask;
}
}
else if (g_str_equal (iso_next_group_option, "ctrl_alt_toggle"))
{
resolved_key_combo_copy (&keys->iso_next_group_combo[0],
&keys->iso_next_group_combo[1]);
n_combos = n_keycodes * 2;
combos = g_new (MetaResolvedKeyCombo, n_combos);
keys->iso_next_group_combo[0].mask = Mod1Mask;
keys->iso_next_group_combo[1].mask = ControlMask;
keys->n_iso_next_group_combos = 2;
for (i = 0; i < n_keycodes; ++i)
{
combos[i].keycode = keycodes[i];
combos[i].mask = Mod1Mask;
combos[i + n_keycodes].keycode = keycodes[i];
combos[i + n_keycodes].mask = ControlMask;
}
}
else if (g_str_equal (iso_next_group_option, "alt_shift_toggle") ||
g_str_equal (iso_next_group_option, "lalt_lshift_toggle"))
{
resolved_key_combo_copy (&keys->iso_next_group_combo[0],
&keys->iso_next_group_combo[1]);
n_combos = n_keycodes * 2;
combos = g_new (MetaResolvedKeyCombo, n_combos);
keys->iso_next_group_combo[0].mask = Mod1Mask;
keys->iso_next_group_combo[1].mask = ShiftMask;
keys->n_iso_next_group_combos = 2;
for (i = 0; i < n_keycodes; ++i)
{
combos[i].keycode = keycodes[i];
combos[i].mask = Mod1Mask;
combos[i + n_keycodes].keycode = keycodes[i];
combos[i + n_keycodes].mask = ShiftMask;
}
}
else
{
resolved_key_combo_reset (keys->iso_next_group_combo);
keys->n_iso_next_group_combos = 0;
n_combos = 0;
combos = NULL;
}
g_free (keycodes);
keys->n_iso_next_group_combos = n_combos;
keys->iso_next_group_combos = combos;
}
static void
@@ -521,35 +517,11 @@ static void
index_binding (MetaKeyBindingManager *keys,
MetaKeyBinding *binding)
{
int i;
guint32 index_key;
for (i = 0; i < binding->resolved_combo.len; i++)
{
MetaKeyBinding *existing;
guint32 index_key;
index_key = key_combo_key (&binding->resolved_combo, i);
existing = g_hash_table_lookup (keys->key_bindings_index,
GINT_TO_POINTER (index_key));
if (existing != NULL)
{
/* Overwrite already indexed keycodes only for the first
* keycode, i.e. we give those primary keycodes precedence
* over non-first ones. */
if (i > 0)
continue;
meta_warning ("Overwriting existing binding of keysym %x"
" with keysym %x (keycode %x).\n",
binding->combo.keysym,
existing->combo.keysym,
binding->resolved_combo.keycodes[i]);
}
g_hash_table_replace (keys->key_bindings_index,
GINT_TO_POINTER (index_key), binding);
}
index_key = key_combo_key (&binding->resolved_combo);
g_hash_table_replace (keys->key_bindings_index,
GINT_TO_POINTER (index_key), binding);
}
static void
@@ -557,19 +529,10 @@ resolve_key_combo (MetaKeyBindingManager *keys,
MetaKeyCombo *combo,
MetaResolvedKeyCombo *resolved_combo)
{
resolved_key_combo_reset (resolved_combo);
if (combo->keysym != 0)
{
get_keycodes_for_keysym (keys, combo->keysym, resolved_combo);
}
else if (combo->keycode != 0)
{
resolved_combo->keycodes = g_new0 (xkb_keycode_t, 1);
resolved_combo->keycodes[0] = combo->keycode;
resolved_combo->len = 1;
}
resolved_combo->keycode = get_first_keycode_for_keysym (keys, combo->keysym);
else
resolved_combo->keycode = combo->keycode;
devirtualize_modifiers (keys, combo->modifiers, &resolved_combo->mask);
}
@@ -728,22 +691,9 @@ static MetaKeyBinding *
get_keybinding (MetaKeyBindingManager *keys,
MetaResolvedKeyCombo *resolved_combo)
{
MetaKeyBinding *binding = NULL;
int i;
for (i = 0; i < resolved_combo->len; i++)
{
guint32 key;
key = key_combo_key (resolved_combo, i);
binding = g_hash_table_lookup (keys->key_bindings_index,
GINT_TO_POINTER (key));
if (binding != NULL)
break;
}
return binding;
guint32 key;
key = key_combo_key (resolved_combo);
return g_hash_table_lookup (keys->key_bindings_index, GINT_TO_POINTER (key));
}
static guint
@@ -873,8 +823,7 @@ get_keybinding_action (MetaKeyBindingManager *keys,
* of mutter keybindings while holding a grab, the overlay-key-only-pressed
* tracking is left to the plugin here.
*/
if (resolved_key_combo_intersect (resolved_combo,
&keys->overlay_resolved_key_combo))
if (resolved_combo->keycode == (unsigned int)keys->overlay_resolved_key_combo.keycode)
return META_KEYBINDING_ACTION_OVERLAY_KEY;
binding = get_keybinding (keys, resolved_combo);
@@ -892,11 +841,14 @@ get_keybinding_action (MetaKeyBindingManager *keys,
}
}
static xkb_mod_mask_t
mask_from_event_params (MetaKeyBindingManager *keys,
unsigned long mask)
static void
resolved_combo_from_event_params (MetaResolvedKeyCombo *resolved_combo,
MetaKeyBindingManager *keys,
unsigned int keycode,
unsigned long mask)
{
return mask & 0xff & ~keys->ignored_modifier_mask;
resolved_combo->keycode = keycode;
resolved_combo->mask = mask & 0xff & ~keys->ignored_modifier_mask;
}
/**
@@ -919,10 +871,8 @@ meta_display_get_keybinding_action (MetaDisplay *display,
unsigned long mask)
{
MetaKeyBindingManager *keys = &display->key_binding_manager;
xkb_keycode_t code = (xkb_keycode_t) keycode;
MetaResolvedKeyCombo resolved_combo = { &code, 1 };
resolved_combo.mask = mask_from_event_params (keys, mask);
MetaResolvedKeyCombo resolved_combo;
resolved_combo_from_event_params (&resolved_combo, keys, keycode, mask);
return get_keybinding_action (keys, &resolved_combo);
}
@@ -1215,36 +1165,30 @@ meta_change_keygrab (MetaKeyBindingManager *keys,
MetaBackendX11 *backend = META_BACKEND_X11 (meta_get_backend ());
Display *xdisplay = meta_backend_x11_get_xdisplay (backend);
GArray *mods;
int i;
/* Grab keycode/modmask, together with
* all combinations of ignored modifiers.
* X provides no better way to do this.
*/
meta_topic (META_DEBUG_KEYBINDINGS,
"%s keybinding keycode %d mask 0x%x on 0x%lx\n",
grab ? "Grabbing" : "Ungrabbing",
resolved_combo->keycode, resolved_combo->mask, xwindow);
mods = calc_grab_modifiers (keys, resolved_combo->mask);
for (i = 0; i < resolved_combo->len; i++)
{
xkb_keycode_t keycode = resolved_combo->keycodes[i];
meta_topic (META_DEBUG_KEYBINDINGS,
"%s keybinding keycode %d mask 0x%x on 0x%lx\n",
grab ? "Grabbing" : "Ungrabbing",
keycode, resolved_combo->mask, xwindow);
if (grab)
XIGrabKeycode (xdisplay,
META_VIRTUAL_CORE_KEYBOARD_ID,
keycode, xwindow,
XIGrabModeSync, XIGrabModeAsync,
False, &mask, mods->len, (XIGrabModifiers *)mods->data);
else
XIUngrabKeycode (xdisplay,
META_VIRTUAL_CORE_KEYBOARD_ID,
keycode, xwindow,
mods->len, (XIGrabModifiers *)mods->data);
}
if (grab)
XIGrabKeycode (xdisplay,
META_VIRTUAL_CORE_KEYBOARD_ID,
resolved_combo->keycode, xwindow,
XIGrabModeSync, XIGrabModeAsync,
False, &mask, mods->len, (XIGrabModifiers *)mods->data);
else
XIUngrabKeycode (xdisplay,
META_VIRTUAL_CORE_KEYBOARD_ID,
resolved_combo->keycode, xwindow,
mods->len, (XIGrabModifiers *)mods->data);
g_array_free (mods, TRUE);
}
@@ -1269,7 +1213,7 @@ change_keygrab_foreach (gpointer key,
if (data->only_per_window != binding_is_per_window)
return;
if (binding->resolved_combo.len == 0)
if (binding->resolved_combo.keycode == 0)
return;
meta_change_keygrab (data->keys, data->xwindow, data->grab, &binding->resolved_combo);
@@ -1297,13 +1241,21 @@ meta_screen_change_keygrabs (MetaScreen *screen,
{
MetaDisplay *display = screen->display;
MetaKeyBindingManager *keys = &display->key_binding_manager;
int i;
if (keys->overlay_resolved_key_combo.len != 0)
if (keys->overlay_resolved_key_combo.keycode != 0)
meta_change_keygrab (keys, screen->xroot, grab, &keys->overlay_resolved_key_combo);
for (i = 0; i < keys->n_iso_next_group_combos; i++)
meta_change_keygrab (keys, screen->xroot, grab, &keys->iso_next_group_combo[i]);
if (keys->iso_next_group_combos)
{
int i = 0;
while (i < keys->n_iso_next_group_combos)
{
if (keys->iso_next_group_combos[i].keycode != 0)
meta_change_keygrab (keys, screen->xroot, grab, &keys->iso_next_group_combos[i]);
++i;
}
}
change_binding_keygrabs (keys, screen->xroot, FALSE, grab);
}
@@ -1415,7 +1367,7 @@ meta_display_grab_accelerator (MetaDisplay *display,
MetaKeyBinding *binding;
MetaKeyGrab *grab;
MetaKeyCombo combo = { 0 };
MetaResolvedKeyCombo resolved_combo = { NULL, 0 };
MetaResolvedKeyCombo resolved_combo = { 0 };
if (!meta_parse_accelerator (accelerator, &combo))
{
@@ -1428,14 +1380,11 @@ meta_display_grab_accelerator (MetaDisplay *display,
resolve_key_combo (keys, &combo, &resolved_combo);
if (resolved_combo.len == 0)
if (resolved_combo.keycode == 0)
return META_KEYBINDING_ACTION_NONE;
if (get_keybinding (keys, &resolved_combo))
{
resolved_key_combo_reset (&resolved_combo);
return META_KEYBINDING_ACTION_NONE;
}
return META_KEYBINDING_ACTION_NONE;
meta_change_keygrab (keys, display->screen->xroot, TRUE, &resolved_combo);
@@ -1466,7 +1415,7 @@ meta_display_ungrab_accelerator (MetaDisplay *display,
MetaKeyBinding *binding;
MetaKeyGrab *grab;
char *key;
MetaResolvedKeyCombo resolved_combo = { NULL, 0 };
MetaResolvedKeyCombo resolved_combo;
g_return_val_if_fail (action != META_KEYBINDING_ACTION_NONE, FALSE);
@@ -1479,22 +1428,18 @@ meta_display_ungrab_accelerator (MetaDisplay *display,
binding = get_keybinding (keys, &resolved_combo);
if (binding)
{
int i;
guint32 index_key;
meta_change_keygrab (keys, display->screen->xroot, FALSE, &binding->resolved_combo);
for (i = 0; i < binding->resolved_combo.len; i++)
{
guint32 index_key = key_combo_key (&binding->resolved_combo, i);
g_hash_table_remove (keys->key_bindings_index, GINT_TO_POINTER (index_key));
}
index_key = key_combo_key (&binding->resolved_combo);
g_hash_table_remove (keys->key_bindings_index, GINT_TO_POINTER (index_key));
g_hash_table_remove (keys->key_bindings, binding);
}
g_hash_table_remove (external_grabs, key);
g_free (key);
resolved_key_combo_reset (&resolved_combo);
return TRUE;
}
@@ -1700,15 +1645,16 @@ process_event (MetaDisplay *display,
ClutterKeyEvent *event)
{
MetaKeyBindingManager *keys = &display->key_binding_manager;
xkb_keycode_t keycode = (xkb_keycode_t) event->hardware_keycode;
MetaResolvedKeyCombo resolved_combo = { &keycode, 1 };
MetaResolvedKeyCombo resolved_combo;
MetaKeyBinding *binding;
/* we used to have release-based bindings but no longer. */
if (event->type == CLUTTER_KEY_RELEASE)
return FALSE;
resolved_combo.mask = mask_from_event_params (keys, event->modifier_state);
resolved_combo_from_event_params (&resolved_combo, keys,
event->hardware_keycode,
event->modifier_state);
binding = get_keybinding (keys, &resolved_combo);
@@ -1762,8 +1708,7 @@ process_overlay_key (MetaDisplay *display,
if (keys->overlay_key_only_pressed)
{
if (! resolved_key_combo_has_keycode (&keys->overlay_resolved_key_combo,
event->hardware_keycode))
if (event->hardware_keycode != (int)keys->overlay_resolved_key_combo.keycode)
{
keys->overlay_key_only_pressed = FALSE;
@@ -1845,8 +1790,7 @@ process_overlay_key (MetaDisplay *display,
return TRUE;
}
else if (event->type == CLUTTER_KEY_PRESS &&
resolved_key_combo_has_keycode (&keys->overlay_resolved_key_combo,
event->hardware_keycode))
event->hardware_keycode == (int)keys->overlay_resolved_key_combo.keycode)
{
keys->overlay_key_only_pressed = TRUE;
/* We keep the keyboard frozen - this allows us to use ReplayKeyboard
@@ -1869,31 +1813,30 @@ process_iso_next_group (MetaDisplay *display,
{
MetaKeyBindingManager *keys = &display->key_binding_manager;
gboolean activate;
xkb_keycode_t keycode = (xkb_keycode_t) event->hardware_keycode;
xkb_mod_mask_t mask;
int i, j;
MetaResolvedKeyCombo resolved_combo;
int i;
if (event->type == CLUTTER_KEY_RELEASE)
return FALSE;
activate = FALSE;
mask = mask_from_event_params (keys, event->modifier_state);
resolved_combo_from_event_params (&resolved_combo, keys,
event->hardware_keycode,
event->modifier_state);
for (i = 0; i < keys->n_iso_next_group_combos; ++i)
{
for (j = 0; j < keys->iso_next_group_combo[i].len; ++j)
if (resolved_combo.keycode == keys->iso_next_group_combos[i].keycode &&
resolved_combo.mask == keys->iso_next_group_combos[i].mask)
{
if (keycode == keys->iso_next_group_combo[i].keycodes[j] &&
mask == keys->iso_next_group_combo[i].mask)
{
/* If the signal handler returns TRUE the keyboard will
remain frozen. It's the signal handler's responsibility
to unfreeze it. */
if (!meta_display_modifiers_accelerator_activate (display))
meta_display_unfreeze_keyboard (display, event->time);
activate = TRUE;
break;
}
/* If the signal handler returns TRUE the keyboard will
remain frozen. It's the signal handler's responsibility
to unfreeze it. */
if (!meta_display_modifiers_accelerator_activate (display))
meta_display_unfreeze_keyboard (display, event->time);
activate = TRUE;
break;
}
}
@@ -3328,42 +3271,6 @@ handle_switch_vt (MetaDisplay *display,
}
#endif /* HAVE_NATIVE_BACKEND */
static void
handle_switch_monitor (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window,
ClutterKeyEvent *event,
MetaKeyBinding *binding,
gpointer dummy)
{
MetaBackend *backend = meta_get_backend ();
MetaMonitorManager *monitor_manager =
meta_backend_get_monitor_manager (backend);
MetaMonitorSwitchConfigType config_type =
meta_monitor_manager_get_switch_config (monitor_manager);
if (!meta_monitor_manager_can_switch_config (monitor_manager))
return;
config_type = (config_type + 1) % (META_MONITOR_SWITCH_CONFIG_UNKNOWN);
meta_monitor_manager_switch_config (monitor_manager, config_type);
}
static void
handle_rotate_monitor (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window,
ClutterKeyEvent *event,
MetaKeyBinding *binding,
gpointer dummy)
{
MetaBackend *backend = meta_get_backend ();
MetaMonitorManager *monitor_manager =
meta_backend_get_monitor_manager (backend);
meta_monitor_manager_rotate_monitor (monitor_manager);
}
/**
* meta_keybindings_set_custom_handler:
* @name: The name of the keybinding to set
@@ -3653,20 +3560,6 @@ init_builtin_key_bindings (MetaDisplay *display)
META_KEYBINDING_ACTION_SET_SPEW_MARK,
handle_set_spew_mark, 0);
add_builtin_keybinding (display,
"switch-monitor",
mutter_keybindings,
META_KEY_BINDING_NONE,
META_KEYBINDING_ACTION_SWITCH_MONITOR,
handle_switch_monitor, 0);
add_builtin_keybinding (display,
"rotate-monitor",
mutter_keybindings,
META_KEY_BINDING_NONE,
META_KEYBINDING_ACTION_ROTATE_MONITOR,
handle_rotate_monitor, 0);
#ifdef HAVE_NATIVE_BACKEND
MetaBackend *backend = meta_get_backend ();
if (META_IS_BACKEND_NATIVE (backend))

View File

@@ -183,10 +183,7 @@ meta_close_dialog_default_hide (MetaCloseDialog *dialog)
}
if (dialog_default->dialog_pid > -1)
{
kill (dialog_default->dialog_pid, SIGTERM);
dialog_default->dialog_pid = -1;
}
kill (dialog_default->dialog_pid, SIGTERM);
}
static void

View File

@@ -31,8 +31,6 @@ enum {
guint dialog_signals[N_SIGNALS] = { 0 };
static GQuark quark_visible = 0;
G_DEFINE_INTERFACE (MetaCloseDialog, meta_close_dialog, G_TYPE_OBJECT)
static void
@@ -52,8 +50,6 @@ meta_close_dialog_default_init (MetaCloseDialogInterface *iface)
0,
NULL, NULL, NULL,
G_TYPE_NONE, 1, META_TYPE_CLOSE_DIALOG_RESPONSE);
quark_visible = g_quark_from_static_string ("meta-close-dialog-visible");
}
/**
@@ -71,7 +67,6 @@ meta_close_dialog_show (MetaCloseDialog *dialog)
iface = META_CLOSE_DIALOG_GET_IFACE (dialog);
iface->show (dialog);
g_object_set_qdata (G_OBJECT (dialog), quark_visible, GINT_TO_POINTER (TRUE));
}
/**
@@ -89,7 +84,6 @@ meta_close_dialog_hide (MetaCloseDialog *dialog)
iface = META_CLOSE_DIALOG_GET_IFACE (dialog);
iface->hide (dialog);
g_object_steal_qdata (G_OBJECT (dialog), quark_visible);
}
/**
@@ -107,36 +101,3 @@ meta_close_dialog_response (MetaCloseDialog *dialog,
g_signal_emit (dialog, dialog_signals[RESPONSE], 0, response);
meta_close_dialog_hide (dialog);
}
/**
* meta_close_dialog_is_visible:
* @dialog: a #MetaCloseDialog
*
* Returns whether @dialog is currently visible.
*
* Returns: #TRUE if @dialog is visible.
**/
gboolean
meta_close_dialog_is_visible (MetaCloseDialog *dialog)
{
return GPOINTER_TO_INT (g_object_get_qdata (G_OBJECT (dialog), quark_visible));
}
/**
* meta_close_dialog_focus:
* @dialog: a #MetaCloseDialog
*
* Call whenever @dialog should receive keyboard focus,
* usually when the window would.
**/
void
meta_close_dialog_focus (MetaCloseDialog *dialog)
{
MetaCloseDialogInterface *iface;
g_return_if_fail (META_IS_CLOSE_DIALOG (dialog));
iface = META_CLOSE_DIALOG_GET_IFACE (dialog);
if (iface->focus)
iface->focus (dialog);
}

View File

@@ -1260,6 +1260,7 @@ update_num_workspaces (MetaScreen *screen,
{
MetaWorkspace *w = l->data;
g_assert (w->windows == NULL);
meta_workspace_remove (w);
}
@@ -1286,25 +1287,21 @@ find_highest_logical_monitor_scale (MetaBackend *backend,
meta_backend_get_monitor_manager (backend);
MetaCursorRenderer *cursor_renderer =
meta_backend_get_cursor_renderer (backend);
ClutterRect cursor_rect;
MetaRectangle cursor_rect;
GList *logical_monitors;
GList *l;
int highest_scale = 0.0;
cursor_rect = meta_cursor_renderer_calculate_rect (cursor_renderer,
cursor_sprite);
cursor_sprite);
logical_monitors =
meta_monitor_manager_get_logical_monitors (monitor_manager);
for (l = logical_monitors; l; l = l->next)
{
MetaLogicalMonitor *logical_monitor = l->data;
ClutterRect logical_monitor_rect =
meta_rectangle_to_clutter_rect (&logical_monitor->rect);
if (!clutter_rect_intersection (&cursor_rect,
&logical_monitor_rect,
NULL))
if (!meta_rectangle_overlap (&cursor_rect, &logical_monitor->rect))
continue;
highest_scale = MAX (highest_scale, logical_monitor->scale);

View File

@@ -168,9 +168,6 @@ struct _MetaStackTracker
guint sync_stack_later;
};
static void
meta_stack_tracker_keep_override_redirect_on_top (MetaStackTracker *tracker);
static inline const char *
get_window_desc (MetaStackTracker *tracker,
guint64 window)
@@ -838,8 +835,6 @@ meta_stack_tracker_sync_stack (MetaStackTracker *tracker)
tracker->sync_stack_later = 0;
}
meta_stack_tracker_keep_override_redirect_on_top (tracker);
meta_stack_tracker_get_stack (tracker, &windows, &n_windows);
meta_windows = NULL;
@@ -1045,37 +1040,6 @@ meta_stack_tracker_lower (MetaStackTracker *tracker,
meta_stack_tracker_raise_above (tracker, window, None);
}
static void
meta_stack_tracker_keep_override_redirect_on_top (MetaStackTracker *tracker)
{
MetaWindow *window;
guint64 *stack;
int n_windows, i;
int topmost_non_or;
meta_stack_tracker_get_stack (tracker, &stack, &n_windows);
for (i = n_windows - 1; i >= 0; i--)
{
window = meta_display_lookup_stack_id (tracker->screen->display, stack[i]);
if (window && window->layer != META_LAYER_OVERRIDE_REDIRECT)
break;
}
topmost_non_or = i;
for (i -= 1; i >= 0; i--)
{
window = meta_display_lookup_stack_id (tracker->screen->display, stack[i]);
if (window && window->layer == META_LAYER_OVERRIDE_REDIRECT)
{
meta_stack_tracker_raise_above (tracker, stack[i], stack[topmost_non_or]);
meta_stack_tracker_get_stack (tracker, &stack, &n_windows);
topmost_non_or -= 1;
}
}
}
void
meta_stack_tracker_restack_managed (MetaStackTracker *tracker,
const guint64 *managed,

View File

@@ -531,8 +531,7 @@ struct _MetaWindowClass
cairo_surface_t **icon,
cairo_surface_t **mini_icon);
uint32_t (*get_client_pid) (MetaWindow *window);
void (*update_main_monitor) (MetaWindow *window,
gboolean user_op);
void (*update_main_monitor) (MetaWindow *window);
void (*main_monitor_changed) (MetaWindow *window,
const MetaLogicalMonitor *old);
};

View File

@@ -2890,7 +2890,6 @@ void
meta_window_tile (MetaWindow *window)
{
MetaMaximizeFlags directions;
MetaRectangle old_frame_rect, old_buffer_rect;
/* Don't do anything if no tiling is requested */
if (window->tile_mode == META_TILE_NONE)
@@ -2904,19 +2903,7 @@ meta_window_tile (MetaWindow *window)
meta_window_maximize_internal (window, directions, NULL);
meta_screen_update_tile_preview (window->screen, FALSE);
meta_window_get_frame_rect (window, &old_frame_rect);
meta_window_get_buffer_rect (window, &old_buffer_rect);
meta_compositor_size_change_window (window->display->compositor, window,
META_SIZE_CHANGE_MAXIMIZE,
&old_frame_rect, &old_buffer_rect);
meta_window_move_resize_internal (window,
(META_MOVE_RESIZE_MOVE_ACTION |
META_MOVE_RESIZE_RESIZE_ACTION |
META_MOVE_RESIZE_STATE_CHANGED),
NorthWestGravity,
window->unconstrained_rect);
meta_window_move_resize_now (window);
if (window->frame)
meta_frame_queue_draw (window->frame);
@@ -3603,7 +3590,7 @@ meta_window_update_monitor (MetaWindow *window,
const MetaLogicalMonitor *old;
old = window->monitor;
META_WINDOW_GET_CLASS (window)->update_main_monitor (window, user_op);
META_WINDOW_GET_CLASS (window)->update_main_monitor (window);
if (old != window->monitor)
{
meta_window_on_all_workspaces_changed (window);
@@ -4369,10 +4356,6 @@ meta_window_focus (MetaWindow *window,
clutter_stage_set_key_focus (stage, NULL);
}
if (window->close_dialog &&
meta_close_dialog_is_visible (window->close_dialog))
meta_close_dialog_focus (window->close_dialog);
if (window->wm_state_demands_attention)
meta_window_unset_demands_attention(window);
@@ -5596,60 +5579,6 @@ update_move_timeout (gpointer data)
return FALSE;
}
static void
update_move_maybe_tile (MetaWindow *window,
int shake_threshold,
int x,
int y)
{
MetaBackend *backend = meta_get_backend ();
MetaMonitorManager *monitor_manager =
meta_backend_get_monitor_manager (backend);
MetaLogicalMonitor *logical_monitor;
MetaRectangle work_area;
/* For side-by-side tiling we are interested in the inside vertical
* edges of the work area of the monitor where the pointer is located,
* and in the outside top edge for maximized tiling.
*
* For maximized tiling we use the outside edge instead of the
* inside edge, because we don't want to force users to maximize
* windows they are placing near the top of their screens.
*
* The "current" idea of meta_window_get_work_area_current_monitor() and
* meta_screen_get_current_monitor() is slightly different: the former
* refers to the monitor which contains the largest part of the window,
* the latter to the one where the pointer is located.
*/
logical_monitor =
meta_monitor_manager_get_logical_monitor_at (monitor_manager, x, y);
if (!logical_monitor)
return;
meta_window_get_work_area_for_monitor (window,
logical_monitor->number,
&work_area);
/* Check if the cursor is in a position which triggers tiling
* and set tile_mode accordingly.
*/
if (meta_window_can_tile_side_by_side (window) &&
x >= logical_monitor->rect.x && x < (work_area.x + shake_threshold))
window->tile_mode = META_TILE_LEFT;
else if (meta_window_can_tile_side_by_side (window) &&
x >= work_area.x + work_area.width - shake_threshold &&
x < (logical_monitor->rect.x + logical_monitor->rect.width))
window->tile_mode = META_TILE_RIGHT;
else if (meta_window_can_tile_maximized (window) &&
y >= logical_monitor->rect.y && y <= work_area.y)
window->tile_mode = META_TILE_MAXIMIZED;
else
window->tile_mode = META_TILE_NONE;
if (window->tile_mode != META_TILE_NONE)
window->tile_monitor_number = logical_monitor->number;
}
static void
update_move (MetaWindow *window,
gboolean snap,
@@ -5705,7 +5634,49 @@ update_move (MetaWindow *window,
!META_WINDOW_MAXIMIZED (window) &&
!META_WINDOW_TILED_SIDE_BY_SIDE (window))
{
update_move_maybe_tile (window, shake_threshold, x, y);
MetaBackend *backend = meta_get_backend ();
MetaMonitorManager *monitor_manager =
meta_backend_get_monitor_manager (backend);
const MetaLogicalMonitor *monitor;
MetaRectangle work_area;
/* For side-by-side tiling we are interested in the inside vertical
* edges of the work area of the monitor where the pointer is located,
* and in the outside top edge for maximized tiling.
*
* For maximized tiling we use the outside edge instead of the
* inside edge, because we don't want to force users to maximize
* windows they are placing near the top of their screens.
*
* The "current" idea of meta_window_get_work_area_current_monitor() and
* meta_screen_get_current_monitor() is slightly different: the former
* refers to the monitor which contains the largest part of the window,
* the latter to the one where the pointer is located.
*/
monitor = meta_monitor_manager_get_logical_monitor_at (monitor_manager,
x, y);
meta_window_get_work_area_for_monitor (window,
monitor->number,
&work_area);
/* Check if the cursor is in a position which triggers tiling
* and set tile_mode accordingly.
*/
if (meta_window_can_tile_side_by_side (window) &&
x >= monitor->rect.x && x < (work_area.x + shake_threshold))
window->tile_mode = META_TILE_LEFT;
else if (meta_window_can_tile_side_by_side (window) &&
x >= work_area.x + work_area.width - shake_threshold &&
x < (monitor->rect.x + monitor->rect.width))
window->tile_mode = META_TILE_RIGHT;
else if (meta_window_can_tile_maximized (window) &&
y >= monitor->rect.y && y <= work_area.y)
window->tile_mode = META_TILE_MAXIMIZED;
else
window->tile_mode = META_TILE_NONE;
if (window->tile_mode != META_TILE_NONE)
window->tile_monitor_number = monitor->number;
}
/* shake loose (unmaximize) maximized or tiled window if dragged beyond
@@ -7524,7 +7495,7 @@ check_transient_for_loop (MetaWindow *window,
{
while (parent)
{
if (parent == window)
if (parent->transient_for == window)
return TRUE;
parent = parent->transient_for;
}

View File

@@ -51,11 +51,8 @@ void meta_backend_set_numlock (MetaBackend *backend,
int meta_backend_get_ui_scaling_factor (MetaBackend *backend);
ClutterActor *meta_backend_get_stage (MetaBackend *backend);
MetaDnd *meta_backend_get_dnd (MetaBackend *backend);
MetaSettings *meta_backend_get_settings (MetaBackend *backend);
void meta_clutter_init (void);
#endif /* META_BACKEND_H */

View File

@@ -42,13 +42,10 @@ struct _MetaCloseDialogInterface
void (* show) (MetaCloseDialog *dialog);
void (* hide) (MetaCloseDialog *dialog);
void (* focus) (MetaCloseDialog *dialog);
};
void meta_close_dialog_show (MetaCloseDialog *dialog);
void meta_close_dialog_hide (MetaCloseDialog *dialog);
void meta_close_dialog_focus (MetaCloseDialog *dialog);
gboolean meta_close_dialog_is_visible (MetaCloseDialog *dialog);
void meta_close_dialog_response (MetaCloseDialog *dialog,
MetaCloseDialogResponse response);

View File

@@ -24,15 +24,6 @@
#include <glib-object.h>
typedef enum
{
META_MONITOR_SWITCH_CONFIG_ALL_MIRROR,
META_MONITOR_SWITCH_CONFIG_ALL_LINEAR,
META_MONITOR_SWITCH_CONFIG_EXTERNAL,
META_MONITOR_SWITCH_CONFIG_BUILTIN,
META_MONITOR_SWITCH_CONFIG_UNKNOWN,
} MetaMonitorSwitchConfigType;
typedef struct _MetaMonitorManagerClass MetaMonitorManagerClass;
typedef struct _MetaMonitorManager MetaMonitorManager;
@@ -48,11 +39,4 @@ gint meta_monitor_manager_get_monitor_for_connector (MetaMonitorManager *manager
gboolean meta_monitor_manager_get_is_builtin_display_on (MetaMonitorManager *manager);
void meta_monitor_manager_switch_config (MetaMonitorManager *manager,
MetaMonitorSwitchConfigType config_type);
gboolean meta_monitor_manager_can_switch_config (MetaMonitorManager *manager);
MetaMonitorSwitchConfigType meta_monitor_manager_get_switch_config (MetaMonitorManager *manager);
#endif /* META_MONITOR_MANAGER_H */

View File

@@ -1,31 +0,0 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* Copyright (C) 2017 Red Hat
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#ifndef META_SETTINGS_H
#define META_SETTINGS_H
#include "meta/types.h"
int meta_settings_get_ui_scaling_factor (MetaSettings *settings);
int meta_settings_get_font_dpi (MetaSettings *settings);
#endif /* META_SETTINGS_H */

View File

@@ -357,8 +357,6 @@ typedef enum _MetaKeyBindingAction
META_KEYBINDING_ACTION_OVERLAY_KEY,
META_KEYBINDING_ACTION_ISO_NEXT_GROUP,
META_KEYBINDING_ACTION_ALWAYS_ON_TOP,
META_KEYBINDING_ACTION_SWITCH_MONITOR,
META_KEYBINDING_ACTION_ROTATE_MONITOR,
META_KEYBINDING_ACTION_LAST
} MetaKeyBindingAction;

View File

@@ -40,6 +40,5 @@ typedef struct _MetaKeyBinding MetaKeyBinding;
typedef struct _MetaCursorTracker MetaCursorTracker;
typedef struct _MetaDnd MetaDnd;
typedef struct _MetaSettings MetaSettings;
#endif

View File

@@ -307,6 +307,7 @@
@serial: configuration serial
@monitors: available monitors
@logical_monitors: current logical monitor configuration
@supported_scales: scaling factors supported by the display server
@properties: display configuration properties
@monitors represent connected physical monitors
@@ -315,17 +316,12 @@
* s vendor: vendor name
* s product: product name
* s serial: product serial
* a(siiddada{sv}) modes: available modes
* s id: mode ID
* a(iidu) modes: available modes
* i width: width in physical pixels
* i height: height in physical pixels
* d refresh rate: refresh rate
* d preferred scale: scale preferred as per calculations
* ad supported scales: scales supported by this mode
* a{sv} properties: optional properties, including:
- "is-current" (b): the mode is currently active mode
- "is-preferred" (b): the mode is the preferred mode
- "is-interlaced" (b): the mode is an interlaced mode
* u flags: mode flags (see below)
* a{sv} properties: optional properties, including:
- "width-mm" (i): physical width of monitor in millimeters
- "height-mm" (i): physical height of monitor in millimeters
@@ -370,6 +366,10 @@
7: 270° flipped
@supported_scales is an ordered list of floating point numbers representing
scale factors of logical monitors supported by the display server.
@layout_mode current layout mode represents the way logical monitors
are layed out on the screen. Possible modes include:
@@ -401,15 +401,12 @@
* "supports-changing-layout-mode" (b): True if the layout mode can be
changed. Absence of this means the
layout mode cannot be changed.
* "global-scale-required" (b): True if all the logical monitors must
always use the same scale. Absence of
this means logical monitor scales can
differ.
-->
<method name="GetCurrentState">
<arg name="serial" direction="out" type="u" />
<arg name="monitors" direction="out" type="a((ssss)a(siiddada{sv})a{sv})" />
<arg name="monitors" direction="out" type="a((ssss)a(iiddu)a{sv})" />
<arg name="logical_monitors" direction="out" type="a(iiduba(ssss)a{sv})" />
<arg name="supported_scales" direction="out" type="ad" />
<arg name="properties" direction="out" type="a{sv}" />
</method>
@@ -435,9 +432,10 @@
* d: scale
* u: transform (see GetCurrentState)
* b primary: true if this is the primary logical monitor
* a(ssa{sv}): a list of monitors, each consisting of:
* a(siida{sv}): a list of monitors, each consisting of:
* s: connector
* s: monitor mode ID
* (iid): monitor mode spec (resolution width, resolution height,
refresh rate)
* a{sv}: monitor properties, including:
- "enable_underscanning" (b): enable monitor underscanning;
may only be set when underscanning
@@ -453,7 +451,7 @@
<method name="ApplyMonitorsConfig">
<arg name="serial" direction="in" type="u" />
<arg name="method" direction="in" type="u" />
<arg name="logical_monitors" direction="in" type="a(iiduba(ssa{sv}))" />
<arg name="logical_monitors" direction="in" type="a(iiduba(s(iid)a{sv}))" />
<arg name="properties" direction="in" type="a{sv}" />
</method>
</interface>

View File

@@ -0,0 +1 @@
timestamp

View File

@@ -24,6 +24,11 @@
#include "backends/meta-backend-private.h"
#include "backends/meta-monitor-config-manager.h"
static float supported_scales_test[] = {
1.0,
2.0
};
struct _MetaMonitorManagerTest
{
MetaMonitorManager parent;
@@ -118,16 +123,9 @@ meta_monitor_manager_test_ensure_initial_config (MetaMonitorManager *manager)
config = meta_monitor_manager_ensure_configured (manager);
if (meta_is_monitor_config_manager_enabled ())
{
meta_monitor_manager_update_logical_state (manager, config);
}
meta_monitor_manager_update_logical_state (manager, config);
else
{
MetaMonitorManagerDeriveFlag flags =
META_MONITOR_MANAGER_DERIVE_FLAG_NONE;
meta_monitor_manager_update_logical_state_derived (manager, flags);
}
meta_monitor_manager_update_logical_state_derived (manager);
}
static void
@@ -281,16 +279,9 @@ meta_monitor_manager_test_apply_monitors_config (MetaMonitorManager *manage
manager->screen_height = 1;
if (meta_is_stage_views_enabled ())
{
meta_monitor_manager_rebuild (manager, NULL);
}
meta_monitor_manager_rebuild (manager, NULL);
else
{
MetaMonitorManagerDeriveFlag flags =
META_MONITOR_MANAGER_DERIVE_FLAG_CONFIGURED_SCALE;
meta_monitor_manager_rebuild_derived (manager, flags);
}
meta_monitor_manager_rebuild_derived (manager);
return TRUE;
}
@@ -320,16 +311,9 @@ meta_monitor_manager_test_apply_monitors_config (MetaMonitorManager *manage
update_screen_size (manager, config);
if (meta_is_stage_views_enabled ())
{
meta_monitor_manager_rebuild (manager, config);
}
meta_monitor_manager_rebuild (manager, config);
else
{
MetaMonitorManagerDeriveFlag flags =
META_MONITOR_MANAGER_DERIVE_FLAG_CONFIGURED_SCALE;
meta_monitor_manager_rebuild_derived (manager, flags);
}
meta_monitor_manager_rebuild_derived (manager);
return TRUE;
}
@@ -359,12 +343,9 @@ meta_monitor_manager_test_apply_configuration (MetaMonitorManager *manager,
MetaOutputInfo **outputs,
unsigned int n_outputs)
{
MetaMonitorManagerDeriveFlag flags =
META_MONITOR_MANAGER_DERIVE_FLAG_NONE;
apply_crtc_assignments (manager, crtcs, n_crtcs, outputs, n_outputs);
legacy_calculate_screen_size (manager);
meta_monitor_manager_rebuild_derived (manager, flags);
meta_monitor_manager_rebuild_derived (manager);
}
static void
@@ -395,7 +376,7 @@ meta_monitor_manager_test_is_transform_handled (MetaMonitorManager *manager,
return manager_test->handles_transforms;
}
static float
static int
meta_monitor_manager_test_calculate_monitor_mode_scale (MetaMonitorManager *manager,
MetaMonitor *monitor,
MetaMonitorMode *monitor_mode)
@@ -409,38 +390,22 @@ meta_monitor_manager_test_calculate_monitor_mode_scale (MetaMonitorManager *mana
return output_test->scale;
}
static float *
meta_monitor_manager_test_calculate_supported_scales (MetaMonitorManager *manager,
MetaLogicalMonitorLayoutMode layout_mode,
MetaMonitor *monitor,
MetaMonitorMode *monitor_mode,
int *n_supported_scales)
static void
meta_monitor_manager_test_get_supported_scales (MetaMonitorManager *manager,
float **scales,
int *n_scales)
{
MetaMonitorScalesConstraint constraints =
META_MONITOR_SCALES_CONSTRAINT_NONE;
switch (layout_mode)
{
case META_LOGICAL_MONITOR_LAYOUT_MODE_LOGICAL:
break;
case META_LOGICAL_MONITOR_LAYOUT_MODE_PHYSICAL:
constraints |= META_MONITOR_SCALES_CONSTRAINT_NO_FRAC;
break;
}
return meta_monitor_calculate_supported_scales (monitor, monitor_mode,
constraints,
n_supported_scales);
*scales = supported_scales_test;
*n_scales = G_N_ELEMENTS (supported_scales_test);
}
static gboolean
is_monitor_framebuffer_scaled (void)
{
MetaBackend *backend = meta_get_backend ();
MetaSettings *settings = meta_backend_get_settings (backend);
return meta_settings_is_experimental_feature_enabled (
settings,
return meta_backend_is_experimental_feature_enabled (
backend,
META_EXPERIMENTAL_FEATURE_SCALE_MONITOR_FRAMEBUFFER);
}
@@ -519,7 +484,7 @@ meta_monitor_manager_test_class_init (MetaMonitorManagerTestClass *klass)
manager_class->tiled_monitor_removed = meta_monitor_manager_test_tiled_monitor_removed;
manager_class->is_transform_handled = meta_monitor_manager_test_is_transform_handled;
manager_class->calculate_monitor_mode_scale = meta_monitor_manager_test_calculate_monitor_mode_scale;
manager_class->calculate_supported_scales = meta_monitor_manager_test_calculate_supported_scales;
manager_class->get_supported_scales = meta_monitor_manager_test_get_supported_scales;
manager_class->get_capabilities = meta_monitor_manager_test_get_capabilities;
manager_class->get_max_screen_size = meta_monitor_manager_test_get_max_screen_size;
manager_class->get_default_layout_mode = meta_monitor_manager_test_get_default_layout_mode;

View File

@@ -34,7 +34,7 @@ typedef struct _MetaMonitorTestSetup
typedef struct _MetaOutputTest
{
float scale;
int scale;
} MetaOutputTest;
#define META_TYPE_MONITOR_MANAGER_TEST (meta_monitor_manager_test_get_type ())

View File

@@ -1,23 +0,0 @@
<monitors version="2">
<configuration>
<logicalmonitor>
<x>0</x>
<y>0</y>
<primary>yes</primary>
<scale>1.5</scale>
<monitor>
<monitorspec>
<connector>DP-1</connector>
<vendor>MetaProduct's Inc.</vendor>
<product>MetaMonitor</product>
<serial>0x123456</serial>
</monitorspec>
<mode>
<width>1200</width>
<height>900</height>
<rate>60.000495910644531</rate>
</mode>
</monitor>
</logicalmonitor>
</configuration>
</monitors>

View File

@@ -1,23 +0,0 @@
<monitors version="2">
<configuration>
<logicalmonitor>
<x>0</x>
<y>0</y>
<primary>yes</primary>
<scale>1.3763440847396851</scale>
<monitor>
<monitorspec>
<connector>DP-1</connector>
<vendor>MetaProduct's Inc.</vendor>
<product>MetaMonitor</product>
<serial>0x123456</serial>
</monitorspec>
<mode>
<width>1024</width>
<height>768</height>
<rate>60.000495910644531</rate>
</mode>
</monitor>
</logicalmonitor>
</configuration>
</monitors>

Some files were not shown because too many files have changed in this diff Show More