1
0
Fork 0
Commit graph

171 commits

Author SHA1 Message Date
Jasper St. Pierre
cd1e1d4bf1 config: Fix a few memory leaks
We were forgetting to unref in a few places.
2014-10-22 15:51:22 -07:00
Jasper St. Pierre
9710c013c5 config: Rename ret to config
We don't return this configuration, so don't name it ret.
2014-10-22 15:49:47 -07:00
Jasper St. Pierre
05f8d79323 config: Fix the memory and other management for MetaMonitorConfig
The code in MetaMonitorConfig was really complex and was trying to do
way too much, using multiple different variables to determine where
things were stored, and trying to do fancy tricks to transfer
ownership.

Add a refcounting system to help simplify this, and clean up the logic.
Simply along the way, this fixes multiple bugs in the monitor config
logic, most notably bug #734889, which was my original goal to fix.
2014-10-22 15:25:12 -07:00
Jasper St. Pierre
f2546dfeea config: Refactor the check for the lid special-case out
This also fixes the case where current_is_for_laptop_lid wasn't properly
set in the default case.
2014-10-22 15:04:34 -07:00
Rui Matos
47e339b46e monitor-manager-xrandr: Don't do extra work on RRScreenChangeNotify
The X server sends several RRScreenChangeNotify events in a burst when
something happens which, currently, causes us to rebuild our view of
the world as many times and notify the upper layers about it which
causes a lot of bogus repeated work like rebuilding background actors.

We can avoid this extra work by looking at the timestamp in the
XRRScreenResources struct which is updated when an X client (including
us!) last changed something and comparing it with the previous
timestamp.

https://bugzilla.gnome.org/show_bug.cgi?id=738630
2014-10-16 20:39:16 +02:00
Rui Matos
016b8f5b4a monitor-manager-xrandr: Use CurrentTime when applying configurations
This is what the xrandr CLI tool does and will allow us to do less
work when we get RRScreenChangeNotify events.

https://bugzilla.gnome.org/show_bug.cgi?id=738630
2014-10-16 20:39:16 +02:00
Rui Matos
b3821c4f90 monitor-manager: Don't try to match the outputs on hotplug
meta_monitor_config_match_current() only matches the number of outputs
and if the output connector, vendor, product and serial match.

In the X backend, this means that we can't use it to bypass doing any
work because it won't detect cases where we actually want to update
ourselves like e.g. an output being turned off either by us or by
another X client (e.g. xrandr).

In the native backend, unlike the xrandr backend, we only get called
on real hotplug events and thus should always trigger the common
hotplug code to (possibly) apply a new mode so the check is pointless
anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=738630
2014-10-16 20:39:16 +02:00
Rui Matos
29e5c6c363 monitor-manager-xrandr: Re-work xrandr event handling
In randr events, configTimestamp can be considered the hotplug time,
i.e. whenever the server notices hardware changes, this value will be
updated.

Having that in mind, we can re-work the logic to make it clearer.
There are no semantic changes.
2014-10-16 20:39:16 +02:00
Rui Matos
e1704acda4 monitor-manager: Remove needless code
Nothing uses this. Signal handlers have access to the new monitor
infos built by make_logical_config() .

https://bugzilla.gnome.org/show_bug.cgi?id=738630
2014-10-16 20:39:16 +02:00
Jasper St. Pierre
d88c8d9ced Make gbm optional
Now it's only required by the native backend. The cursor code is getting
quite messy, but it was already considerable messy to start with.
2014-10-15 10:40:28 -07:00
Jasper St. Pierre
60ab11ecbf cursor: Clean up code flow slightly
Reverse the set of expressions so testing for gbm is at the top.
2014-10-15 10:36:42 -07:00
Jasper St. Pierre
722d4c6c17 native: Implement monitor hotplug in the native backend
Use gudev to notice when new monitors are hotplugged, and when they are,
update the configuration.
2014-10-14 13:56:48 -07:00
Jasper St. Pierre
cc8462969d monitor-manager: Put the common hotplug code in a common path as well
So we can reuse it in the KMS backend.
2014-10-14 13:56:48 -07:00
Jasper St. Pierre
989bb6ebb1 monitor-manager: Simplify reading the current configuration
Make a wrapper in MetaMonitorManager that handles freeing the existing
configuration for us.
2014-10-14 13:56:48 -07:00
Jasper St. Pierre
1dbda68839 monitor-manager-xrandr: Refactor handle_xevent once more
Make the flow a bit clearer, and inline a method only used once.
2014-10-14 13:56:48 -07:00
Jasper St. Pierre
22f91eba8d backend: Fix minor comment 2014-10-12 13:41:03 -07:00
Jasper St. Pierre
e7356917b0 meta-monitor-manager-xrandr: Simplify handle_xevent
The code here was a bit messy with the addition of
hotplug_mode_update, and the comments were a bit confusing and
inaccurate. Clean it up and comment it a bit better to make the flow and
intention more clear.
2014-10-03 15:12:00 -06:00
Rui Matos
fa58752276 backend-native: Handle keyboard repeat settings
We need to tell clutter's evdev backend about the desktop's key repeat
settings so that our own key bindings event processing and
gnome-shell's chrome widgets get their fake key events for continuous
key press as they expect.

Note that the wayland frontend filters out these events and thus
wayland clients do not see them as specced.

https://bugzilla.gnome.org/show_bug.cgi?id=728055
2014-10-03 18:31:44 +02:00
Rui Matos
478b75e803 backend-x11: Re-upload keymap when new keyboard devices are added
The X server applies a default keymap to hotplugged keyboard
devices. To enforce our current settings we must re-upload the keymap
when a new keyboard shows up.

Note that setting the VCK keymap causes the server to propagate it
to all slave keyboard devices.

https://bugzilla.gnome.org/show_bug.cgi?id=737673
2014-10-02 19:14:03 +02:00
Jasper St. Pierre
21bffe4aef monitor-manager-xrandr: Fix small leak for invalid properties
If the property is invalid, then we leak the allocated buffer. Make sure
to free it in this case.
2014-09-29 17:54:20 -06:00
Jasper St. Pierre
f3595ebd08 monitor-manager: Make sure to emit PropertiesChanged for PowerSaveMode
We overrode the property for PowerSaveMode, which meant that gdbus's
auto-generated PropertiesChanged code wasn't being run.

This really confused gnome-rr and gnome-settings-daemon's power plugin
about the current DPMS state of the display, since they used their
cached PowerSaveMode properties, and never saw a PropertiesChanged being
emitted.

If a display was on, they set it to off, and then set it back on, the
setting back on would never fire, since they thought the display was
already off.

To fix this, remove our custom property override and just respond to
notifications on the object.

Namely, this fixes the DPMS management when receiving notifications so
that it now properly times out.
2014-09-25 20:17:53 -06:00
Jasper St. Pierre
488dd0b402 Support for hardware cursor sizes other than 64x64 on wayland
Use the new DRM capabilities to figure out the correct cursor size, and
make sure that matches instead of hardcoding 64x64. This fixes incorrect
rendering on some newer AMD cards that support 256x256 cursors.

Based heavily on a patch by:
Alvaro Fernando García <alvarofernandogarcia@gmail.com>
2014-09-24 15:42:17 -06:00
Jasper St. Pierre
892699da73 edid: Remove unused declarations 2014-09-12 11:55:08 -06:00
Rui Matos
59c5ac0cb5 backends: Add a keymap-layout-group-changed signal
We'll need this in the wayland frontend to send a modifiers event to
clients.

Note that on X11 this isn't needed because key events include the
group index encoded in modifier state. If we ever want to make the
wayland frontend work with the X11 backend we'll handle it then.

https://bugzilla.gnome.org/show_bug.cgi?id=736433
2014-09-11 19:05:53 +02:00
Owen W. Taylor
33689ec558 Moving setting of window-scaling-factor to meta_clutter_init()
Setting the scaling factor immediately after calling clutter_init()
avoids creating the stage at one size, then later resizing it to
a different size.

https://bugzilla.gnome.org/show_bug.cgi?id=736279
2014-09-08 14:40:50 -04:00
Owen W. Taylor
602dd7fdf2 MetaBackendX11: Don't XResizeWindow behind clutter's back
In the case of a nested Wayland compositor inside an X session,
Clutter is managing the toplevel window size, so don't call
XResizeWindow on it - this will confuse Clutter and get the size
and the hints out of sync on the toplevel window.

https://bugzilla.gnome.org/show_bug.cgi?id=736279
2014-09-08 14:40:50 -04:00
Jasper St. Pierre
037c3438a3 meta-monitor-config: Fix small whitespace issue 2014-09-05 09:50:37 -07:00
Jasper St. Pierre
3f1f1645c7 backend: Fix build
I keep forgetting to squash.
2014-09-04 13:19:13 -07:00
Jasper St. Pierre
18a82688e2 backend: Create the core device monitor
Otherwise, nothing will ever create it.
2014-09-04 13:15:03 -07:00
Jasper St. Pierre
27d6b2645e meta-backend: Fix the max device calculation on removal
If we add device 2, then add device 254, then remove device 254, then
the max device ID will be 253. Scan through all the devices again on
removal to calculate a new max device ID.
2014-09-04 12:17:15 -07:00
Jasper St. Pierre
fee40353e2 meta-backend: Fix build 2014-09-04 12:15:50 -07:00
Jasper St. Pierre
659360d543 backend: Pre-emptively create idle monitors based on clutter events
Rather than have the DBus code control this, move this into
MetaBackend. This also lets us destroy idle monitors when appropriate,
rather than leaking them forever.
2014-09-04 12:06:03 -07:00
Jasper St. Pierre
4c08d9a53b configure: Don't conditionalize gbm
Let's just say it's required for now.
2014-08-27 12:05:00 -04:00
Jasper St. Pierre
9063e4568c configure: Conditionalize libinput and gbm too 2014-08-27 09:57:43 -04:00
Jasper St. Pierre
3ee09c6251 meta-monitor-xrandr: Assign a name to the mode
Based on a downstream Endless patch. They use this to show a proper mode
name to the users.
2014-08-23 08:54:06 -04:00
Jasper St. Pierre
b879af46b3 stage: Refine our assertions for overlays in MetaStage
We indeed call this function if we're not an X11 compositor, but in this
case we're simply calling it to say that we have no cursor overlay. Make
sure not to assert fail in this case.
2014-08-21 18:06:53 -04:00
Jasper St. Pierre
30953cf2d7 stage: Make the API take a CoglTexture
MetaCursorReference doesn't really need to be part of the API.
2014-08-21 15:04:58 -04:00
Jasper St. Pierre
c7fa446ee7 stage: Refactor the cursor drawing code into a generic "overlay" system
This isn't really anything but a really small actor system. This will be
used for DND cursors as well.
2014-08-21 15:04:57 -04:00
Jasper St. Pierre
35e0982e35 xrandr: Port some checks to XCB so we don't have to deal with BadName
RandR's QueryOutputProperty request makes the incredible decision of
throwing a BadName if you pass a property that doesn't exist, which
means that trying to check if a property exists is a royal pain when
using Xlib.

XCB's interface is much more friendly about errors and not having global
state and things like that, so use that instead to query our backlight
property.
2014-08-19 11:08:44 -04:00
Jasper St. Pierre
277df44cfb xrandr: Fix build
Gah, I keep forgetting to squash for some reason.
2014-08-18 18:01:04 -04:00
Jasper St. Pierre
2dded1e510 xrandr: Don't use RRQueryOutputProperty to fetch hotplug_mode_update
If the property doesn't exist, a BadName error will be generated. This
is a terrible API, but it's what we're stuck with. Use
RRGetOutputProperty instead.
2014-08-18 18:00:33 -04:00
Jasper St. Pierre
0b98fbab0a Remove a few extra "ui.h" includes 2014-08-17 23:02:15 -04:00
Jasper St. Pierre
0e758a9e65 display: Establish a separate state variable for routing events
We've long used a switch statement on the grab operation to determine
where events should go. The issue with MetaGrabOp is that it's a mixture
of a few different things, including event routing, state management,
and the behavior to choose during operations.

This leads to poorly defined event routing and hard-to-follow logic,
since it's sometimes unclear what should point where, and our utility
methods for determining grab operations apart can be poorly named.

To fix this, establish the concept of a "event route", which describes
where events should be routed to.
2014-08-15 16:08:49 -04:00
Jasper St. Pierre
471e6b9e13 cursor-renderer: Popups need to set cursors, too
Popups could not set the cursor image, because the cursor tracker would
ignore window cursors if we had a popup active. The correct condition to
check for is already in should_block_wayland. Rename this to the more
sensible name windows_are_interactable, and use it in the cursor tracker.
2014-08-15 13:46:54 -04:00
Jasper St. Pierre
cbc92b847f meta-stage: Remove an unused variable 2014-08-15 10:00:53 -04:00
Jasper St. Pierre
39f65f9f86 backend: Add a keymap-changed signal 2014-08-14 17:36:29 -04:00
Jasper St. Pierre
bda2d6d1ac backend-x11: Don't leak the keymap
meta_backend_get_keymap is supposed to return a static keymap, not a new
one every time. Cache it internally. We don't update it when the keymap
changes on the server, but we'll do this soon.
2014-08-14 17:35:49 -04:00
Jasper St. Pierre
5f0fab2156 Conditionalize Wayland support again 2014-08-13 20:28:22 -04:00
Jasper St. Pierre
467465c99c backend: Create the stage in the backend, rather than the compositor
This allows creating the stage much earlier than it otherwise would have
been. Our initialization sequence has always been a bit haphazard, with
first the MetaBackend created, then the MetaDisplay, and inside of that,
the MetaScreen and MetaCompositor.

Refactor this out so that the MetaBackend creates the Clutter
stage. Besides the clarity of early initialization, we now have much
easier access to the stage, allowing us to use it for things such as
key focus and beyond.
2014-08-13 20:08:46 -04:00
Rui Matos
7d54631ebf backends: Make MetaBackend available to introspection
This moves meta-backend.h under meta/ and, for now, just exposes to
introspection the methods that we actually need in gnome-shell.

https://bugzilla.gnome.org/show_bug.cgi?id=734301
2014-08-07 11:31:59 +02:00