Skip to content

Commit 1b7dadc

Browse files
committed
DesktopSwitch: show unsupported widget if backend does not have switch
capability
1 parent 0990829 commit 1b7dadc

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

panel/backends/lxqttaskbartypes.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ enum class LXQtTaskBarBackendAction
1414
MaximizeHorizontally,
1515
Minimize,
1616
RollUp,
17-
FullScreen
17+
FullScreen,
18+
DesktopSwitch
1819
};
1920

2021
enum class LXQtTaskBarWindowProperty

panel/backends/xcb/lxqttaskbarbackend_x11.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,9 @@ bool LXQtTaskbarX11Backend::supportsAction(WId windowId, LXQtTaskBarBackendActio
202202
x11Action = NET::ActionFullScreen;
203203
break;
204204

205+
case LXQtTaskBarBackendAction::DesktopSwitch:
206+
return true;
207+
205208
default:
206209
return false;
207210
}

plugin-desktopswitch/desktopswitch.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -318,11 +318,12 @@ void DesktopSwitchWidget::wheelEvent(QWheelEvent *e)
318318

319319
ILXQtPanelPlugin *DesktopSwitchPluginLibrary::instance(const ILXQtPanelPluginStartupInfo &startupInfo) const
320320
{
321-
return new DesktopSwitch{startupInfo};
321+
LXQtPanelApplication *a = reinterpret_cast<LXQtPanelApplication*>(qApp);
322+
auto wmBackend = a ? a->getWMBackend() : nullptr;
323+
if(!wmBackend || !wmBackend->supportsAction(0, LXQtTaskBarBackendAction::DesktopSwitch))
324+
return new DesktopSwitchUnsupported{startupInfo};
322325

323-
//TODO: detect dummy backend and show unsupported message?
324-
// Or instead remove it and make just a message box at application start
325-
//return new DesktopSwitchUnsupported{startupInfo};
326+
return new DesktopSwitch{startupInfo};
326327
}
327328

328329
DesktopSwitchUnsupported::DesktopSwitchUnsupported(const ILXQtPanelPluginStartupInfo &startupInfo)

0 commit comments

Comments
 (0)