Commit Graph

354 Commits (95ff4a2d49d897739f58e931454edf0272798038)

Author SHA1 Message Date
David Edmundson 273a3fabd0 [activities] Fix logic error in user menu blocking activity updates
Summary:
There's an attempt to block updates to activities whilst the popup menu
is showing.

In one of the two code paths for positioning the menu the block is set
but instead of releasing the block at the end of the exec locks it
again.

CCBUG: 335725

Test Plan:
On X11 changed activities with the popup menu near the bottom.
It still flickered like crazy whilst the menu is open (see bug report)
But now at least fixes itself after

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16101
2018-10-10 14:54:16 +01:00
Martin Flöser b6befb4ef8 Use AbstractClient in UserActionsMenu for tab functionality 2018-05-20 19:50:35 +02:00
Martin Flöser 7defd93047 Port TabGroup from Client to AbstractClient
First step towards a return of window tabbing.
2018-05-20 19:50:29 +02:00
Martin Flöser 7bf4a94286 Disable window rule configuration for Wayland
Summary:
The window rule detection is too bound to X11 for it to work for
Wayland windows. In fact it results in the config module just crashing.
Thus it's better to just disable the items in the menu. As it's only for
X11 windows we can also enforce platform xcb for the rules dialog.

Test Plan: Menu disabled on Wayland window, menu enabled on Xwayland window

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D10594
2018-02-21 18:06:47 +01:00
Martin Flöser 4cef894e87 Drop delegating Workspace::slotToggleCompositing
Instead connect global shortcut directly to method in Compositor.
2017-09-24 10:15:13 +02:00
Martin Flöser 9b1827803f Drop delegating Workspace::slotInvertScreen
Instead directly connect global shortcut to the method in Platform.
2017-09-24 10:10:52 +02:00
Martin Flöser 51561052ec Move screen inversion through XRandr into X11 standalone platform
Summary:
By moving the functionality into the Platform API we can also implement
support on other platforms which support this in general (e.g. DRM once
Roman's color adjustment patches landed).

Reviewers: #kwin, #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D7447
2017-09-01 18:04:28 +02:00
Martin Flöser bbca8c6677 Implement the shortcut caption suffix for Wayland windows
Summary:
The generation of the shortcut caption part is moved from Client to
AbstractClient. The ShellClient also has a captionSuffix and implements
the full part in caption.

Overall this needs more refactoring to support more sharing between the
two implementations. But one step at a time.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D7093
2017-08-12 11:31:33 +02:00
Martin Flöser 150a0357b4 Replace delegate slots for window shortcut by std::bind expressions
Summary:
Client had a slot to delay a call when setting up a global shortcut for
the Client. This can be simplified by using a std::bind expression.
Similar the action was connected to a one line lambda which can be
expressed through a std::bind expression as well.

Test Plan: New added auto test still passes

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D6801
2017-07-29 17:43:38 +02:00
Martin Flöser c8c15f0057 Use std::bind expression for Workspace::slotWindowtoDesktop
Summary:
This way we don't need the sender() hack to get the value set on the
QAction.

Test Plan: New autotest in master still passes

Reviewers: #kwin, #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D6811
2017-07-29 17:41:33 +02:00
Martin Flöser 7d3517060f Drop the Workspace::slotSwitchWindowFoo methods
Summary:
They were only delegating into switchWindow(Direction), so let's do the
same through std::bind in kwinbindings and delegate to it directly in
scripting's WorkspaceWrapper.

Test Plan: Not yet, want to add test case for Workspace::switchWindow

Reviewers: #kwin, #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D6791
2017-07-29 17:40:55 +02:00
Martin Flöser c29d6093ba Implement support for window shortcuts for Wayland windows
Summary:
Moves most of the implementation from Client to AbstractClient, so that
it can be used for both Client and ShellClient. Only the X11 specific
code is kept in Client.

Not yet implemented is updating the window caption.

Unfortunately the testing of this feature showed that setting a window
shortcut is not working on Wayland at all (the Qt widget doesn't properly
catch the shortcut). So this feature is currently only of erm theoretical
use.

Test Plan: Added new test case. No testing in real world as explained.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D6818
2017-07-25 07:12:42 +02:00
Martin Flöser ddd957f0a6 Merge branch 'Plasma/5.10' 2017-07-25 07:10:45 +02:00
Martin Flöser 4c996a57d4 Call Platform::setupActionForGlobalAccel on the Client shortcut
Summary:
Platform::setupActionForGlobalAccel is an important call on X11 platform.
Without the x11 timestamp doesn't get updated and calls in KWin might
fail - e.g. the activation of the Client which is supposed to happen.

Test Plan: compiles

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D6802
2017-07-25 07:09:41 +02:00
Martin Flöser 763fbf5faf Make Workspace::switchWindow operate on AbstractClient
Summary:
By using AbstractClient instead of Client the method works also for
Wayland windows.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D6275
2017-06-20 07:11:57 +02:00
Luboš Luňák 1427dbad9b remove executable bit from a .cpp file 2017-04-19 12:39:42 +02:00
Kai Uwe Broulik 93938d60b8 Restore global menu support
This brings back global menu support in KWin.
The DBusMenu infrastructure is different that we just read the DBus service name and
menu object path from the windows rather than passing around window IDs on DBus which
won't work on Wayland.

Differential Revision: https://phabricator.kde.org/D3089
2017-01-11 10:21:03 +01:00
Martin Gräßlin 8e32dd4fdc Cycle between windows of the same desktop on switch
Summary:
When switching virtual desktops using shortcuts, the behavior is to
switch to a virtual desktop in the opposite direction if the current
one is on the edges of the layout. For example, in a one row layout with
4 virtual desktops, "Switch One Desktop to the Left" while in virtual
desktop # 1 will send the user to virtual desktop # 4. Likewise, in a 3
rows layout with 9 virtual desktops, "Switch One Desktop Down" while in
virtual desktop # 8 will lead the user to desktop # 2.

This patch uses the same behavior whilst changing windows using
"Switch to Window Above|Below|to the Right|to the Left".
For example, in a 3 display set-up (my set-up), the user would go from an
application in the rightmost position to an application in the leftmost
position using just one key combination: "Switch to Window to the Right".
Currently, the shortcuts are no-op in these cases (ie, trying "Switch to
Window to the Left" from the leftmost window has no outcome, which is
mostly accurate with the shortcut semantics but totally useless in behavior).

Reviewers: #vdg, #kwin, graesslin

Reviewed By: #kwin, graesslin

Subscribers: luebking, subdiff, colomar, graesslin, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D3602
2016-12-22 21:27:28 +01:00
Martin Gräßlin c0b2e5dc8b VirtualDesktopGrid operates on VirtualDesktop objects
Summary:
The VirtualDesktopGrid is ported to the new VirtualDesktop objects. The
grid consists now of QVector<VirtualDesktop*> rows and a QVector of
those rows.

This change requires to adjust the code using the VirtualDesktopGrid.
This mostly affects VirtualDesktopManger. The methods for toLeft, above,
next, etc are now all operating on VirtualDesktop with the uint variants
- if still present - only delegating to the new method. The Functor
objects are also adjusted, though mostly still providing the old API for
compatibility.

In KWin core only one now ambiguous call is adjusted (useractions) and
the desktop grid usage in EffectsHandlerImpl is adjusted. Other usages
are not yet adjusted and need porting to fully get rid of the old
uint-based API.

Test Plan: VD test still passes

Reviewers: #kwin, #plasma_on_wayland, hein

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D3327
2016-11-15 07:20:23 +01:00
Martin Gräßlin 0b0aae7761 Pass a desktopfile name to kcmshell5
Summary:
In order to have a proper window icon for kcmshell5 on Wayland KWin
needs to pass a desktop file name as command line argument.

The desktop file of kwinfocus is used as it uses the
preferences-system-windows icon which is also the icon on X11.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D3162
2016-10-26 08:11:52 +02:00
Martin Gräßlin cb7f922222 Set componentName to KWIN_NAME on QActions for KGlobalAccel
By setting the componentName we ensure that test don't grab the shortcut.

CCBUG: 368675
2016-09-13 13:02:20 +02:00
David Edmundson 8db4a6ff39 authorizeKAction -> authorizeAction 2016-08-30 12:52:41 +01:00
Martin Gräßlin 24bdfc6317 Make Toplevel::window() no longer virtual and introduce ::windowId()
Summary:
Toplevel::window() is the actual X11 window. This makes it difficult
to use as the generic identifier for both X11 and Wayland. The Wayland
ShellClient already had a windowId() which is now added to Toplevel as
a virtual method. On X11 (Toplevel default) it returns the window().

The method window() now returns XCB_WINDOW_NONE for classes without
the Toplevel::m_client, such as ShellClient. Thus it allows to properly
check whether we are on Wayland or X11.

The code is adjusted to use windowId where a generic id is needed and
to properly check whether the window is valid before using it where
a window() is used.

This also fixes at least one additional unknown issue in
Workspace::setActiveClient

where the windowId of a Wayland client was passed to X11.

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1527
2016-05-17 14:13:24 +02:00
Martin Gräßlin f0ec89f38b Merge Options::MouseLower for Client and AbstractClient
The implementation in Client::performMouseCommand can now also be
used directly in AbstractClient.
2016-02-18 10:30:58 +01:00
Martin Gräßlin df4bb8296a Port Workspace::clientUnderMouse to AbstractClient 2016-02-18 10:28:00 +01:00
Martin Gräßlin 757523a324 Use kwinApp()->config() instead of KSharedConfig::openConfig()
That way all over kwin we can inject a custom config in the autotests.
2016-01-29 11:24:18 +01:00
Martin Gräßlin 14b9046ad2 Unblock signals in child processes
We need to unblock the signals blocked with pthread_sigmask.
This caused kdeinit to block, because it relies on SIGUSR1.

BUG: 356580
FIXED-IN: 5.5.1
REVIEW: 126361
2015-12-15 13:03:30 +01:00
Martin Gräßlin 4805316c0a Use popup instead of exec on useractions menu on Wayland
With exec we might hit a dead lock. With popup we don't hit that.
Not happy about this change, but well...
2015-11-09 13:57:41 +01:00
Nick Shaforostoff 3a8d7d866a optimize string operations
-use qstringliteral only when necessary (i.e. not in concat or comparison)
-use qbytearray instead of qstring when dealing with latin1 input and output (glplatform)
-use qstringref to extract numbers from strings (glplatform)
-define qt_use_qstringbuilder to optimize all string concatenations
-anidata: use ctor init lists, add windowType member initialization

REVIEW: 125933
2015-11-05 14:14:06 +00:00
Martin Gräßlin 717a48a2a1 Move move/resize related mouse command handling to AbstractClient
Code is refactored in a sufficient way so that we can handle the
move/resize mouse commands also from AbstractClient::performMouseCommand.
2015-10-26 09:21:36 +01:00
Martin Gräßlin b8e68307bb Move buttonDown from Client to AbstractClient
Bundled together with other moveResize functionality. We might need
to investigate whether this variable is needed at all.
2015-10-26 09:21:36 +01:00
Martin Gräßlin 8a3be2bacd Move the Position mode from Client to AbstractClient 2015-10-26 09:21:36 +01:00
Martin Gräßlin 84c7575cbf Move (inverted)MoveOffset to AbstractClient 2015-10-26 09:21:36 +01:00
Martin Gräßlin 3514b4d691 Track whehter moveResize is unrestricted in AbstractClient 2015-10-26 09:21:36 +01:00
Martin Gräßlin b5e8e3511e Track whether Client is in moveResizeMode in AbstractClient
Variable moveResizeMode replaced by protected methods isMoveResize()
and setMoveResize().
2015-10-26 09:21:36 +01:00
Thomas Lübking 801e60b290 force grab on useractions menu
Workaround, this *seems* a Qt problem.
The grab fails while the button is down - Qt then also seems
to release the keyboard.

Not sending it to the deco didn't help either - nevertheless it seems
(from the Qt code) as if the button is currently grabbed
(the code is a dumb forward to xcb_grab_pointer)

As a workaround, the patch simply ensures a grab on releasing a button when
the popup is visible.

BUG: 351112
FIXED-IN: 5.5
2015-10-16 15:45:55 +02:00
Thomas Lübking b0dc3b3009 shuffle mnemonics in "more actions"
in a way so that each entry has its own
drawback: present mnemonics changed.
they however also change with i18n.

REVIEW: 125434
BUG: 319695
FIXED-IN: 5.5
2015-09-29 23:03:20 +02:00
Thomas Lübking 0302b97aea prevent calling xrandr w/o extension available
BUG: 343844
FIXED-IN: 5.5
REVIEW: 125074
2015-09-29 23:02:41 +02:00
Thomas Lübking a97b6e0fd6 delete the quit process, not UserActinsMenu
BUG: 351643
FIXED-IN: 5.4.1
REVIEW: 124895
2015-08-24 21:58:49 +02:00
Martin Gräßlin 8d407157c4 Provide a base implementation for performMouseCommand in AbstractClient
Most commands can be operated directly in AbstractClient already which
means less code duplication to make the commands work for wayland
clients.
2015-07-09 16:34:19 +02:00
Martin Gräßlin f6458fa1e8 Port away from KToolInvocation
The problem with KToolInvocation is that it creates a dead lock on
Wayland in case kdeinit is not already running. It starts kdeinit
and does a QProcess::waitForFinished and our kdeinit needs to interact
with the wayland server. So dead lock.

As KRun also calls into the dangerous code path it's no option which
leaves us with QProcess to start the processes.

A nice side-effect is that we no don't need to link KF5::Service any
more from kwin_core. Now once Plasma and Notification don't use it
any more, it will be gone completely.
2015-07-07 17:35:57 +02:00
Martin Gräßlin a1a89d3d1e Disable Activities support on Wayland
This is a temporary workaround for bug 349992 which causes freezes
during startup as kwin and kamd dead lock each other on DBus.

To workaround we don't call Activities::create and check in every
usage of Activities::self() whether the pointer is valid.

As a result kwin_wayland now starts pretty fast.

CCBUG: 349992
2015-07-07 11:48:42 +02:00
Thomas Lübking d053c31571 don't offer to set window shortcut if rule forced
since the rule would trump the configured shortcut

BUG: 332184
FIXED-IN: 5.4
REVIEW: 124125
2015-06-19 19:47:51 +02:00
Martin Gräßlin 9d580a628f Use screen name as additional information in UseractionsMenu
New format: Screen 1 (HDMI1)

REVIEW: 123849
2015-05-19 09:53:14 +02:00
Thomas Lübking b3bd9ea144 make switchWindow FROM stickies act on current VD
it's probably the user expectation and few windows
are on all desktops

BUG: 331512
REVIEW: 123640
2015-05-15 23:55:26 +02:00
Martin Gräßlin 1e7a28033b Drop no longer needed dynamic_cast in Workspace::performWindowOperation 2015-05-08 12:43:46 +02:00
Martin Gräßlin 7a74413712 Drop dynamic_cast from UserActionsMenu::slotSendToDesktop 2015-05-08 12:43:46 +02:00
Martin Gräßlin fdcaf2b86f Make Workspace::active_client an AbstractClient 2015-05-08 12:43:46 +02:00
Martin Gräßlin 4f1c98773e Workspace::showWindowMenu operates on AbstractClient 2015-05-08 12:43:45 +02:00
Martin Gräßlin ddcd4dab59 Workspace::slotWindowTo(Previous|Next)Desktop operates on AbstractClient 2015-05-08 12:43:45 +02:00