├── .gitignore ├── CMakeLists.txt ├── COPYING ├── README.md ├── cmake ├── Wayland.cmake └── cmake_uninstall.cmake.in ├── data ├── CMakeLists.txt └── restricted_interfaces.conf.in ├── orbital-launcher.desktop ├── protocol ├── desktop-shell.xml ├── dropdown.xml ├── gamma-control.xml ├── orbital-authorizer-helper.xml ├── orbital-authorizer.xml ├── orbital-clipboard.xml └── screenshooter.xml ├── scripts ├── CMakeLists.txt ├── orbital.in └── startorbital.in ├── src ├── CMakeLists.txt ├── authorizer_helper │ ├── CMakeLists.txt │ └── main.cpp ├── client │ ├── CMakeLists.txt │ ├── activeregion.cpp │ ├── activeregion.h │ ├── client.cpp │ ├── client.h │ ├── clipboard.cpp │ ├── clipboard.h │ ├── dbusinterface.h │ ├── element.cpp │ ├── element.h │ ├── elements │ │ ├── background │ │ │ ├── Background.qml │ │ │ ├── element │ │ │ └── it_IT.ts │ │ ├── battery │ │ │ ├── element │ │ │ └── main.qml │ │ ├── clipboard │ │ │ ├── element │ │ │ └── main.qml │ │ ├── clock │ │ │ ├── Clock.qml │ │ │ ├── element │ │ │ └── it_IT.ts │ │ ├── deviceexplorer │ │ │ ├── element │ │ │ ├── explorer.qml │ │ │ ├── it_IT.ts │ │ │ ├── maincontent.qml │ │ │ └── noservice.qml │ │ ├── launcher │ │ │ ├── Launcher.qml │ │ │ ├── element │ │ │ └── it_IT.ts │ │ ├── lockscreen │ │ │ ├── LockScreen.qml │ │ │ └── element │ │ ├── logout │ │ │ ├── Logout.qml │ │ │ ├── element │ │ │ └── it_IT.ts │ │ ├── mixer │ │ │ ├── Mixer.qml │ │ │ ├── element │ │ │ └── it_IT.ts │ │ ├── overlay │ │ │ ├── Leave.qml │ │ │ ├── Overlay.qml │ │ │ ├── Volume.qml │ │ │ ├── element │ │ │ └── it_IT.ts │ │ ├── pager │ │ │ ├── Pager.qml │ │ │ ├── element │ │ │ └── it_IT.ts │ │ ├── panel │ │ │ ├── Panel.qml │ │ │ ├── element │ │ │ └── it_IT.ts │ │ ├── runner │ │ │ ├── Runner.qml │ │ │ ├── element │ │ │ └── it_IT.ts │ │ ├── systray │ │ │ ├── element │ │ │ └── main.qml │ │ └── taskbar │ │ │ ├── TaskBar.qml │ │ │ ├── TaskBarItem.qml │ │ │ ├── element │ │ │ └── it_IT.ts │ ├── filebrowser.cpp │ ├── filebrowser.h │ ├── grab.cpp │ ├── grab.h │ ├── iconimageprovider.cpp │ ├── iconimageprovider.h │ ├── keysequence.cpp │ ├── keysequence.h │ ├── layout.cpp │ ├── layout.h │ ├── main.cpp │ ├── notification.cpp │ ├── notification.h │ ├── panel.cpp │ ├── panel.h │ ├── popup.cpp │ ├── popup.h │ ├── qml │ │ ├── Button.qml │ │ ├── Element.qml │ │ ├── ElementConfiguration.qml │ │ ├── ElementsChooser.qml │ │ ├── Icon.qml │ │ ├── Notifications.qml │ │ ├── PopupElement.qml │ │ ├── Rotator.qml │ │ └── Spacer.qml │ ├── resources.qrc │ ├── services │ │ ├── datetime │ │ │ ├── CMakeLists.txt │ │ │ ├── datetime.cpp │ │ │ ├── datetime.h │ │ │ └── qmldir │ │ ├── hardware │ │ │ ├── CMakeLists.txt │ │ │ ├── clibackend.cpp │ │ │ ├── clibackend.h │ │ │ ├── hardwareservice.cpp │ │ │ ├── hardwareservice.h │ │ │ ├── qmldir │ │ │ ├── solidbackend.cpp │ │ │ └── solidbackend.h │ │ ├── login │ │ │ ├── CMakeLists.txt │ │ │ ├── clibackend.cpp │ │ │ ├── clibackend.h │ │ │ ├── logindbackend.cpp │ │ │ ├── logindbackend.h │ │ │ ├── loginservice.cpp │ │ │ ├── loginservice.h │ │ │ └── qmldir │ │ ├── mixer │ │ │ ├── CMakeLists.txt │ │ │ ├── alsamixer.cpp │ │ │ ├── alsamixer.h │ │ │ ├── mixerservice.cpp │ │ │ ├── mixerservice.h │ │ │ ├── pulseaudiomixer.cpp │ │ │ ├── pulseaudiomixer.h │ │ │ └── qmldir │ │ ├── mpris │ │ │ ├── CMakeLists.txt │ │ │ ├── mprisservice.cpp │ │ │ ├── mprisservice.h │ │ │ └── qmldir │ │ ├── notifications │ │ │ ├── CMakeLists.txt │ │ │ ├── notificationsadaptor.cpp │ │ │ ├── notificationsadaptor.h │ │ │ ├── notificationsiconprovider.cpp │ │ │ ├── notificationsiconprovider.h │ │ │ ├── notificationsservice.cpp │ │ │ ├── notificationsservice.h │ │ │ ├── org.freedesktop.Notifications.xml │ │ │ └── qmldir │ │ ├── processlauncher │ │ │ ├── CMakeLists.txt │ │ │ ├── processlauncher.cpp │ │ │ ├── processlauncher.h │ │ │ └── qmldir │ │ └── statusnotifier │ │ │ ├── CMakeLists.txt │ │ │ ├── org.kde.StatusNotifierItem.xml │ │ │ ├── org.kde.StatusNotifierWatcher.xml │ │ │ ├── qmldir │ │ │ ├── statusnotifiericonprovider.cpp │ │ │ ├── statusnotifiericonprovider.h │ │ │ ├── statusnotifieritem.cpp │ │ │ ├── statusnotifieritem.h │ │ │ ├── statusnotifierservice.cpp │ │ │ ├── statusnotifierservice.h │ │ │ ├── statusnotifierwatcher.cpp │ │ │ └── statusnotifierwatcher.h │ ├── shellui.cpp │ ├── shellui.h │ ├── style.cpp │ ├── style.h │ ├── styleitem.cpp │ ├── styleitem.h │ ├── styles │ │ ├── chiaro │ │ │ ├── style │ │ │ └── style.qml │ │ └── shadow │ │ │ ├── style │ │ │ └── style.qml │ ├── tooltip.cpp │ ├── tooltip.h │ ├── translations │ │ └── it_IT.ts │ ├── uiscreen.cpp │ ├── uiscreen.h │ ├── utils.h │ ├── window.cpp │ ├── window.h │ ├── workspace.cpp │ └── workspace.h ├── compositor │ ├── CMakeLists.txt │ ├── animation.cpp │ ├── animation.h │ ├── animationcurve.h │ ├── authorizer.cpp │ ├── authorizer.h │ ├── backend.cpp │ ├── backend.h │ ├── binding.cpp │ ├── binding.h │ ├── clipboard.cpp │ ├── clipboard.h │ ├── compositor.cpp │ ├── compositor.h │ ├── dashboard.cpp │ ├── dashboard.h │ ├── debug.cpp │ ├── debug.h │ ├── desktop-shell │ │ ├── desktop-shell-launcher.cpp │ │ ├── desktop-shell-launcher.h │ │ ├── desktop-shell-notifications.cpp │ │ ├── desktop-shell-notifications.h │ │ ├── desktop-shell-settings.cpp │ │ ├── desktop-shell-settings.h │ │ ├── desktop-shell-splash.cpp │ │ ├── desktop-shell-splash.h │ │ ├── desktop-shell-window.cpp │ │ ├── desktop-shell-window.h │ │ ├── desktop-shell-workspace.cpp │ │ ├── desktop-shell-workspace.h │ │ ├── desktop-shell.cpp │ │ └── desktop-shell.h │ ├── drm-backend │ │ ├── CMakeLists.txt │ │ ├── drm-backend.cpp │ │ ├── drm-backend.h │ │ └── drm-backend.json │ ├── dropdown.cpp │ ├── dropdown.h │ ├── dummysurface.cpp │ ├── dummysurface.h │ ├── effect.cpp │ ├── effect.h │ ├── effects │ │ ├── desktopgrid.cpp │ │ ├── desktopgrid.h │ │ ├── zoomeffect.cpp │ │ └── zoomeffect.h │ ├── fmt │ │ ├── format.cc │ │ ├── format.h │ │ ├── ostream.cc │ │ └── ostream.h │ ├── focusscope.cpp │ ├── focusscope.h │ ├── gammacontrol.cpp │ ├── gammacontrol.h │ ├── global.h │ ├── interface.cpp │ ├── interface.h │ ├── layer.cpp │ ├── layer.h │ ├── main.cpp │ ├── orbital-launch.cpp │ ├── output.cpp │ ├── output.h │ ├── pager.cpp │ ├── pager.h │ ├── screenshooter.cpp │ ├── screenshooter.h │ ├── seat.cpp │ ├── seat.h │ ├── shell.cpp │ ├── shell.h │ ├── shellsurface.cpp │ ├── shellsurface.h │ ├── shellview.cpp │ ├── shellview.h │ ├── surface.cpp │ ├── surface.h │ ├── timer.h │ ├── transform.cpp │ ├── transform.h │ ├── utils.h │ ├── view.cpp │ ├── view.h │ ├── wayland-backend │ │ ├── CMakeLists.txt │ │ ├── wayland-backend.cpp │ │ ├── wayland-backend.h │ │ └── wayland-backend.json │ ├── weston-desktop │ │ ├── wdesktop.cpp │ │ └── wdesktop.h │ ├── workspace.cpp │ ├── workspace.h │ ├── x11-backend │ │ ├── CMakeLists.txt │ │ ├── backend.cpp │ │ ├── x11-backend.cpp │ │ ├── x11-backend.h │ │ └── x11-backend.json │ ├── xwayland.cpp │ └── xwayland.h ├── launcher │ ├── CMakeLists.txt │ ├── launcher.qml │ ├── main.cpp │ ├── matchermodel.cpp │ ├── matchermodel.h │ └── resources.qrc ├── screenshooter │ ├── CMakeLists.txt │ ├── imgur │ ├── main.cpp │ ├── resources.qrc │ └── screenshooter.qml ├── splash │ ├── CMakeLists.txt │ ├── main.cpp │ ├── resources.qrc │ ├── splash.qml │ └── translations │ │ └── it_IT.ts └── utils │ ├── desktopfile.cpp │ ├── desktopfile.h │ ├── stringview.cpp │ └── stringview.h └── test ├── CMakeLists.txt └── compositor ├── CMakeLists.txt ├── tst_maybe.cpp └── tst_stringview.cpp /.gitignore: -------------------------------------------------------------------------------- 1 | build/* 2 | CMakeLists.txt.user 3 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8) 2 | project(orbital) 3 | 4 | set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wno-unused-parameter -Werror=return-type") 5 | set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") 6 | set(CMAKE_CXX_STANDARD 14) 7 | set(CMAKE_CXX_STANDARD_REQUIRED true) 8 | 9 | include(Wayland) 10 | find_package(PkgConfig "0.22" REQUIRED) 11 | 12 | add_definitions(-DQT_NO_CAST_FROM_ASCII 13 | -DQT_NO_CAST_TO_ASCII 14 | -DQT_NO_CAST_FROM_BYTEARRAY 15 | -DQT_NO_URL_CAST_FROM_STRING 16 | -DQT_USE_QSTRINGBUILDER) 17 | 18 | add_subdirectory(src) 19 | 20 | enable_testing() 21 | add_custom_target(check ${CMAKE_CTEST_COMMAND} -V) 22 | add_subdirectory(test EXCLUDE_FROM_ALL) 23 | 24 | # uninstall target 25 | configure_file( 26 | "${CMAKE_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" 27 | "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" 28 | IMMEDIATE @ONLY) 29 | 30 | add_custom_target(uninstall 31 | COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) 32 | 33 | add_subdirectory(scripts) 34 | add_subdirectory(data) 35 | 36 | install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/orbital-launcher.desktop DESTINATION /etc/xdg/autostart) 37 | -------------------------------------------------------------------------------- /cmake/cmake_uninstall.cmake.in: -------------------------------------------------------------------------------- 1 | if (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 2 | message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") 3 | endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 4 | 5 | cmake_policy(SET CMP0007 OLD) 6 | file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) 7 | string(REGEX REPLACE "\n" ";" files "${files}") 8 | list(REVERSE files) 9 | foreach (file ${files}) 10 | message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") 11 | if (EXISTS "$ENV{DESTDIR}${file}") 12 | execute_process( 13 | COMMAND @CMAKE_COMMAND@ -E remove "$ENV{DESTDIR}${file}" 14 | OUTPUT_VARIABLE rm_out 15 | RESULT_VARIABLE rm_retval 16 | ) 17 | if(NOT ${rm_retval} EQUAL 0) 18 | message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") 19 | endif (NOT ${rm_retval} EQUAL 0) 20 | else (EXISTS "$ENV{DESTDIR}${file}") 21 | message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") 22 | endif (EXISTS "$ENV{DESTDIR}${file}") 23 | endforeach(file) 24 | 25 | # Manually remove the directories until we don't find a better way 26 | execute_process( 27 | COMMAND @CMAKE_COMMAND@ -E remove_directory "$ENV{DESTDIR}/@CMAKE_INSTALL_PREFIX@/lib/orbital" 28 | ) 29 | execute_process( 30 | COMMAND @CMAKE_COMMAND@ -E remove_directory "$ENV{DESTDIR}/@CMAKE_INSTALL_PREFIX@/share/orbital" 31 | ) -------------------------------------------------------------------------------- /data/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | configure_file(restricted_interfaces.conf.in ${CMAKE_CURRENT_BINARY_DIR}/restricted_interfaces.conf @ONLY) 2 | install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/restricted_interfaces.conf DESTINATION /etc/orbital) 3 | -------------------------------------------------------------------------------- /data/restricted_interfaces.conf.in: -------------------------------------------------------------------------------- 1 | { 2 | "orbital_screenshooter" : { 3 | "@CMAKE_INSTALL_PREFIX@/bin/orbital-screenshooter": "allow" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /orbital-launcher.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | TryExec=orbital-launcher 3 | OnlyShowIn=Orbital; 4 | -------------------------------------------------------------------------------- /protocol/dropdown.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /protocol/gamma-control.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Copyright © 2015 Giulio camuffo 6 | 7 | Permission to use, copy, modify, distribute, and sell this 8 | software and its documentation for any purpose is hereby granted 9 | without fee, provided that the above copyright notice appear in 10 | all copies and that both that copyright notice and this permission 11 | notice appear in supporting documentation, and that the name of 12 | the copyright holders not be used in advertising or publicity 13 | pertaining to distribution of the software without specific, 14 | written prior permission. The copyright holders make no 15 | representations about the suitability of this software for any 16 | purpose. It is provided "as is" without express or implied 17 | warranty. 18 | 19 | THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS 20 | SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 21 | FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 23 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN 24 | AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 25 | ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF 26 | THIS SOFTWARE. 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /protocol/orbital-authorizer-helper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /protocol/orbital-clipboard.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /protocol/screenshooter.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /scripts/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | configure_file(startorbital.in ${CMAKE_CURRENT_BINARY_DIR}/startorbital @ONLY) 3 | install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/startorbital DESTINATION ${CMAKE_INSTALL_PREFIX}/libexec) 4 | 5 | # configure_file(orbital.in ${CMAKE_CURRENT_BINARY_DIR}/orbital @ONLY) 6 | # install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/orbital DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) 7 | -------------------------------------------------------------------------------- /scripts/orbital.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | socket=0 4 | tmppath="$XDG_CACHE_HOME" 5 | if [ -z "$tmppath" ]; then 6 | tmppath="$HOME/.cache" 7 | fi 8 | tmppath="$tmppath/orbital" 9 | mkdir -p $tmppath >/dev/null 10 | 11 | configpath="$XDG_CONFIG_HOME" 12 | if [ -z "$configpath" ]; then 13 | configpath="$HOME/.config" 14 | fi 15 | configpath="$configpath/orbital" 16 | mkdir -p $configpath > /dev/null 17 | 18 | while getopts S:v name 19 | do 20 | case $name in 21 | S) if [ $OPTARG -eq $OPTARG 2> /dev/null ]; then 22 | socket="$OPTARG" 23 | else 24 | echo "Invalid socket number. Must be an integer." 25 | exit 1 26 | fi;; 27 | v) echo "Version: 0.1" 28 | exit 0;; 29 | ?) printf "Usage: %s: [-Svalue]\n" $0 30 | exit 2;; 31 | esac 32 | done 33 | 34 | logfile="$tmppath/orbital-$socket.log" 35 | out="$tmppath/orbital-$socket.out" 36 | err="$tmppath/orbital-$socket.err" 37 | 38 | function watch() { 39 | IFS='' 40 | while read a; do 41 | echo "$a" 42 | echo "$2$a" >>$logfile 43 | done < "$1" 44 | } 45 | 46 | rm $logfile $out $err > /dev/null 2>&1 47 | mkfifo $out $err 48 | trap 'rm "$out" "$err"' EXIT 49 | 50 | exec 4<>"$out" 51 | exec 5<>"$err" 52 | 53 | (watch "$out" "stdout: " >&1) & 54 | pidout=$! 55 | (watch "$err" "stderr: " >&2) & 56 | piderr=$! 57 | 58 | exec 1>&4 59 | exec 2>&5 60 | 61 | plugin="@Nuclear_PREFIX@/lib/nuclear-shell/nuclear-desktop-shell.so" 62 | if [ "@Nuclear_VERSION@" == "0.0.1" ]; then 63 | plugin="@Nuclear_PREFIX@/lib/nuclear-shell/nuclear-shell.so" 64 | fi 65 | args="--shell=$plugin --nuclear-client=@CMAKE_INSTALL_PREFIX@/libexec/startorbital --session-file=$configpath/session -Swayland-$socket" 66 | 67 | if [ -z "$DBUS_SESSION_BUS_ADDRESS" ] && type dbus-launch >/dev/null; then 68 | eval `dbus-launch --sh-syntax` 69 | fi 70 | 71 | export QT_QPA_PLATFORM="wayland" 72 | export XDG_CURRENT_DESKTOP="orbital" 73 | 74 | if [ -z "$DISPLAY" ]; then 75 | stdbuf -oL -eL weston-launch -- $args 76 | else 77 | stdbuf -oL -eL weston $args 78 | fi 79 | 80 | if [[ $DBUS_SESSION_BUS_PID ]]; then 81 | kill $DBUS_SESSION_BUS_PID 82 | fi 83 | 84 | kill $pidout 85 | kill $piderr 86 | -------------------------------------------------------------------------------- /scripts/startorbital.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | exec @CMAKE_INSTALL_PREFIX@/libexec/orbital-client 4 | -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | add_subdirectory(client) 3 | add_subdirectory(compositor) 4 | add_subdirectory(splash) 5 | add_subdirectory(screenshooter) 6 | add_subdirectory(launcher) 7 | add_subdirectory(authorizer_helper) 8 | -------------------------------------------------------------------------------- /src/authorizer_helper/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | pkg_check_modules(WaylandClient wayland-client REQUIRED) 2 | 3 | find_package(Qt5Core) 4 | 5 | set(CMAKE_AUTOMOC ON) 6 | set(CMAKE_INCLUDE_CURRENT_DIR ON) 7 | 8 | set(SOURCES main.cpp) 9 | 10 | wayland_add_protocol_client(SOURCES ../../protocol/orbital-authorizer-helper.xml authorizer-helper) 11 | 12 | list(APPEND defines "LIBEXEC_PATH=\"${CMAKE_INSTALL_PREFIX}/libexec\"") 13 | list(APPEND defines "QT_MESSAGELOGCONTEXT") 14 | 15 | add_executable(orbital-authorizer-helper ${SOURCES} ${RESOURCES}) 16 | qt5_use_modules(orbital-authorizer-helper Core) 17 | target_link_libraries(orbital-authorizer-helper wayland-client) 18 | set_target_properties(orbital-authorizer-helper PROPERTIES COMPILE_DEFINITIONS "${defines}") 19 | 20 | install(TARGETS orbital-authorizer-helper DESTINATION libexec) 21 | -------------------------------------------------------------------------------- /src/client/activeregion.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #include 21 | #include 22 | 23 | #include "activeregion.h" 24 | #include "client.h" 25 | 26 | #include "wayland-desktop-shell-client-protocol.h" 27 | 28 | ActiveRegion::ActiveRegion(QQuickItem *p) 29 | : QQuickItem(p) 30 | , m_activeRegion(nullptr) 31 | { 32 | connect(this, &QQuickItem::windowChanged, this, &ActiveRegion::init, Qt::QueuedConnection); 33 | } 34 | 35 | ActiveRegion::~ActiveRegion() 36 | { 37 | if (m_activeRegion) { 38 | active_region_destroy(m_activeRegion); 39 | } 40 | } 41 | 42 | void ActiveRegion::updateGeometry() 43 | { 44 | QRect rect = mapRectToScene(QRectF(x(), y(), width(), height())).toRect(); 45 | if (rect != m_geometry) { 46 | m_geometry = rect; 47 | active_region_set_geometry(m_activeRegion, rect.x(), rect.y(), rect.width(), rect.height()); 48 | } 49 | } 50 | 51 | void ActiveRegion::init() 52 | { 53 | if (m_activeRegion) { 54 | active_region_destroy(m_activeRegion); 55 | m_activeRegion = nullptr; 56 | disconnect(m_updateConnection); 57 | } 58 | 59 | if (window()) { 60 | QRect rect = mapRectToScene(QRectF(x(), y(), width(), height())).toRect(); 61 | m_activeRegion = Client::client()->createActiveRegion(window(), rect); 62 | m_geometry = rect; 63 | 64 | m_updateConnection = connect(window(), &QQuickWindow::beforeRendering, this, &ActiveRegion::updateGeometry); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/client/activeregion.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef ORBITAL_CLIENT_ACTIVE_REGION_H 21 | #define ORBITAL_CLIENT_ACTIVE_REGION_H 22 | 23 | #include 24 | #include 25 | 26 | struct active_region; 27 | 28 | class ActiveRegion : public QQuickItem 29 | { 30 | Q_OBJECT 31 | public: 32 | explicit ActiveRegion(QQuickItem *p = nullptr); 33 | ~ActiveRegion(); 34 | 35 | private: 36 | void init(); 37 | void updateGeometry(); 38 | 39 | active_region *m_activeRegion; 40 | QMetaObject::Connection m_updateConnection; 41 | QRect m_geometry; 42 | }; 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /src/client/clipboard.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #include "clipboard.h" 25 | 26 | Clipboard::Clipboard(QObject *p) 27 | : QObject(p) 28 | { 29 | QClipboard *clipboard = QGuiApplication::clipboard(); 30 | connect(clipboard, &QClipboard::dataChanged, this, &Clipboard::textChanged); 31 | } 32 | 33 | QString Clipboard::text() const 34 | { 35 | return QGuiApplication::clipboard()->text(); 36 | } 37 | 38 | void Clipboard::setText(const QString &text) 39 | { 40 | QGuiApplication::clipboard()->setText(text); 41 | } 42 | 43 | Clipboard *Clipboard::qmlAttachedProperties(QObject *obj) 44 | { 45 | return new Clipboard(obj); 46 | } 47 | -------------------------------------------------------------------------------- /src/client/clipboard.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef ORBITAL_CLIPBOARD_H 21 | #define ORBITAL_CLIPBOARD_H 22 | 23 | #include 24 | #include 25 | 26 | class Clipboard : public QObject 27 | { 28 | Q_OBJECT 29 | Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged) 30 | public: 31 | Clipboard(QObject *p = nullptr); 32 | 33 | QString text() const; 34 | void setText(const QString &text); 35 | 36 | static Clipboard *qmlAttachedProperties(QObject *object); 37 | 38 | signals: 39 | void textChanged(); 40 | 41 | }; 42 | 43 | QML_DECLARE_TYPE(Clipboard) 44 | QML_DECLARE_TYPEINFO(Clipboard, QML_HAS_ATTACHED_PROPERTIES) 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /src/client/dbusinterface.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef ORBITAL_DBUSINTERFACE_H 21 | #define ORBITAL_DBUSINTERFACE_H 22 | 23 | #include 24 | 25 | /* QDBusInterface uses blocking calls in its constructor. 26 | * If the remote app is slow it may block us too, so that is not acceptable. 27 | * QDBusAbstractInterface does not block, but it only has a protected constructor 28 | * so subclass it. 29 | * https://bugreports.qt.io/browse/QTBUG-14485 30 | */ 31 | class DBusInterface : public QDBusAbstractInterface 32 | { 33 | public: 34 | DBusInterface(const QString &service, const QString &path, const QString &interface, 35 | const QDBusConnection &connection = QDBusConnection::sessionBus()) 36 | : QDBusAbstractInterface(service, path, qPrintable(interface), connection, nullptr) 37 | { } 38 | }; 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /src/client/elements/background/element: -------------------------------------------------------------------------------- 1 | { 2 | "prettyName": "Background", 3 | "qmlFile": "Background.qml", 4 | "type": "background" 5 | } 6 | -------------------------------------------------------------------------------- /src/client/elements/background/it_IT.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Background 6 | 7 | 8 | Scaled 9 | Riscalato 10 | 11 | 12 | 13 | Scaled, keep aspect 14 | Riscalato, stesso formato 15 | 16 | 17 | 18 | Scaled, cropped 19 | Riscalato, tagliata 20 | 21 | 22 | 23 | Centered 24 | Centrato 25 | 26 | 27 | 28 | Tiled 29 | Ripetuto 30 | 31 | 32 | 33 | Configure background 34 | Configura lo sfondo 35 | 36 | 37 | 38 | Save configuration 39 | Salva la configurazione 40 | 41 | 42 | 43 | Configure applets 44 | Configura le applet 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /src/client/elements/battery/element: -------------------------------------------------------------------------------- 1 | { 2 | "prettyName": "Battery", 3 | "qmlFile": "main.qml" 4 | } 5 | -------------------------------------------------------------------------------- /src/client/elements/clipboard/element: -------------------------------------------------------------------------------- 1 | { 2 | "prettyName": "Clipboard", 3 | "qmlFile": "main.qml" 4 | } 5 | -------------------------------------------------------------------------------- /src/client/elements/clock/element: -------------------------------------------------------------------------------- 1 | { 2 | "prettyName": "Digital Clock", 3 | "qmlFile": "Clock.qml" 4 | } 5 | -------------------------------------------------------------------------------- /src/client/elements/clock/it_IT.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/client/elements/deviceexplorer/element: -------------------------------------------------------------------------------- 1 | { 2 | "prettyName": "Device explorer", 3 | "qmlFile": "explorer.qml" 4 | } 5 | -------------------------------------------------------------------------------- /src/client/elements/deviceexplorer/explorer.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | import QtQuick 2.1 21 | import Orbital 1.0 22 | import QtQuick.Controls 1.0 23 | 24 | PopupElement { 25 | id: explorer 26 | width: 250 27 | height: 300 28 | 29 | Layout.preferredWidth: 30 30 | Layout.preferredHeight: 30 31 | 32 | minimumWidth: 100 33 | minimumHeight: 100 34 | 35 | Loader { 36 | id: loader 37 | source: "maincontent.qml" 38 | onStatusChanged: { 39 | if (status == Loader.Error) { 40 | source = "noservice.qml" 41 | } 42 | } 43 | } 44 | 45 | popupContent: loader.item 46 | popupWidth: 250 47 | popupHeight: 300 48 | buttonContent: Icon { 49 | id: icon 50 | anchors.fill: parent 51 | icon: "image://icon/drive-harddisk" 52 | 53 | onClicked: showPopup() 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/client/elements/deviceexplorer/it_IT.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | noservice 6 | 7 | Error: unable to load the "HardwareService" service. Check your installation. 8 | Impossibile caricare il servizio "HardwareService". Controllare l'installazione. 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/client/elements/deviceexplorer/noservice.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | import QtQuick 2.1 21 | import Orbital 1.0 22 | import QtQuick.Controls 1.0 23 | 24 | Rectangle { 25 | id: noserviceContent 26 | color: Qt.rgba(CurrentStyle.backgroundColor.r, CurrentStyle.backgroundColor.g, CurrentStyle.backgroundColor.b, 0.6) 27 | anchors.fill: parent 28 | Text { 29 | text: qsTr("Error: unable to load the \"HardwareService\" service. Check your installation.") 30 | anchors.fill: parent 31 | anchors.margins: 5 32 | wrapMode: Text.Wrap 33 | verticalAlignment: Text.AlignVCenter 34 | horizontalAlignment: Text.AlignHCenter 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/client/elements/launcher/element: -------------------------------------------------------------------------------- 1 | { 2 | "prettyName": "Launcher", 3 | "qmlFile": "Launcher.qml" 4 | } 5 | 6 | -------------------------------------------------------------------------------- /src/client/elements/launcher/it_IT.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Launcher 6 | 7 | 8 | Icon: 9 | Icona: 10 | 11 | 12 | 13 | Process: 14 | Comando: 15 | 16 | 17 | 18 | Ok 19 | Ok 20 | 21 | 22 | 23 | Cancel 24 | Annulla 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/client/elements/lockscreen/LockScreen.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | import QtQuick 2.2 21 | import QtQuick.Window 2.2 22 | import QtQuick.Controls 1.1 23 | import Orbital 1.0 24 | import Orbital.LoginService 1.0 25 | 26 | Element { 27 | width: Screen.width 28 | height: Screen.height 29 | 30 | Connections { 31 | target: LoginManager 32 | onSessionUnlocked: password.text = "" 33 | } 34 | 35 | contentItem: Item { 36 | anchors.centerIn: parent 37 | 38 | TextField { 39 | id: password 40 | anchors.centerIn: parent 41 | placeholderText: qsTr("Password") 42 | width: 200 43 | height: 30 44 | enabled: !LoginManager.busy 45 | echoMode: TextInput.Password 46 | focus: true 47 | 48 | onAccepted: tryUnlock() 49 | } 50 | 51 | Button { 52 | anchors.horizontalCenter: password.horizontalCenter 53 | anchors.top: password.bottom 54 | anchors.margins: 5 55 | width: 100 56 | height: 30 57 | caption: qsTr("Unlock") 58 | enabled: !LoginManager.busy 59 | 60 | onClicked: tryUnlock() 61 | } 62 | } 63 | 64 | function tryUnlock() { 65 | LoginManager.tryUnlockSession(password.text, function(res) { 66 | password.text = ""; 67 | }) 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /src/client/elements/lockscreen/element: -------------------------------------------------------------------------------- 1 | { 2 | "prettyName": "Lock screen", 3 | "qmlFile": "LockScreen.qml", 4 | "type": "lockscreen" 5 | } 6 | -------------------------------------------------------------------------------- /src/client/elements/logout/element: -------------------------------------------------------------------------------- 1 | { 2 | "prettyName": "Logout", 3 | "qmlFile": "Logout.qml" 4 | } 5 | -------------------------------------------------------------------------------- /src/client/elements/logout/it_IT.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Logout 6 | 7 | 8 | Log out 9 | Esci 10 | 11 | 12 | 13 | Shutdown 14 | Spegni 15 | 16 | 17 | 18 | Reboot 19 | Riavvia 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/client/elements/mixer/element: -------------------------------------------------------------------------------- 1 | { 2 | "prettyName": "Mixer", 3 | "qmlFile": "Mixer.qml" 4 | } 5 | -------------------------------------------------------------------------------- /src/client/elements/mixer/it_IT.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Mixer 6 | 7 | 8 | Muted 9 | Muto 10 | 11 | 12 | 13 | Volume at %1% 14 | Volume al %1% 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/client/elements/overlay/Overlay.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | import QtQuick 2.1 21 | import QtQuick.Window 2.1 22 | import Orbital 1.0 23 | 24 | Element { 25 | width: Screen.width 26 | height: Screen.height 27 | objectName: "overlay" 28 | 29 | readonly property bool hasContent: volume.visible || leave.visible 30 | 31 | onHasContentChanged: { 32 | if (hasContent) { 33 | showContent(); 34 | } else { 35 | hideContent(); 36 | } 37 | } 38 | 39 | contentItem: Item { 40 | anchors.fill: parent 41 | Volume { id: volume } 42 | Leave { id: leave} 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/client/elements/overlay/Volume.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | import QtQuick 2.1 21 | import QtQuick.Window 2.1 22 | import QtQuick.Controls 1.0 23 | import QtGraphicalEffects 1.0 24 | 25 | import Orbital 1.0 26 | import Orbital.MixerService 1.0 27 | 28 | Rectangle { 29 | id: volume 30 | 31 | width: Screen.width / 4 32 | x: Screen.width / 2 - width / 2 33 | y: Screen.height * 4 / 5 34 | height: 30 35 | 36 | color: "dimgrey" 37 | radius: 4 38 | opacity: 0 39 | visible: opacity > 0 40 | 41 | Behavior on opacity { PropertyAnimation { duration: 300 } } 42 | 43 | RectangularGlow { 44 | id: effect 45 | anchors.fill: volume 46 | glowRadius: 2 47 | spread: 0 48 | color: "grey" 49 | } 50 | 51 | Timer { 52 | id: timer 53 | repeat: false 54 | interval: 2000 55 | 56 | onTriggered: volume.opacity = 0 57 | } 58 | 59 | ProgressBar { 60 | id: bar 61 | anchors.fill: parent 62 | 63 | anchors.leftMargin: 10 64 | anchors.rightMargin: anchors.leftMargin 65 | anchors.topMargin: 4 66 | anchors.bottomMargin: anchors.topMargin 67 | 68 | maximumValue: 100 69 | Binding { target: bar; property: "value"; value: Mixer.muted ? 0 : Mixer.master } 70 | Connections { 71 | target: Mixer 72 | onBindingTriggered: { 73 | volume.opacity = 1; 74 | timer.restart(); 75 | } 76 | } 77 | 78 | Behavior on value { PropertyAnimation { duration: 200 } } 79 | 80 | Text { 81 | anchors.centerIn: parent 82 | text: parent.value.toFixed(0) + "%" 83 | font.pixelSize: 3 * parent.height / 4 84 | } 85 | 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /src/client/elements/overlay/element: -------------------------------------------------------------------------------- 1 | { 2 | "prettyName": "Overlay", 3 | "qmlFile": "Overlay.qml", 4 | "type": "overlay" 5 | } 6 | -------------------------------------------------------------------------------- /src/client/elements/overlay/it_IT.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Leave 6 | 7 | 8 | Click anywhere to abort 9 | Clicca ovunque per annullare 10 | 11 | 12 | 13 | Logging out in 14 | %2... 15 | Uscita in %2... 16 | 17 | 18 | 19 | Shutting down in 20 | %2... 21 | Spegnimento in %2... 22 | 23 | 24 | 25 | Rebooting in 26 | %2... 27 | Riavvio in %2... 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/client/elements/pager/element: -------------------------------------------------------------------------------- 1 | { 2 | "prettyName": "Pager", 3 | "qmlFile": "Pager.qml" 4 | } 5 | -------------------------------------------------------------------------------- /src/client/elements/pager/it_IT.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/client/elements/panel/element: -------------------------------------------------------------------------------- 1 | { 2 | "prettyName": "Panel", 3 | "qmlFile": "Panel.qml", 4 | "type": "panel" 5 | } 6 | -------------------------------------------------------------------------------- /src/client/elements/panel/it_IT.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/client/elements/runner/Runner.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | import QtQuick 2.1 21 | import Orbital 1.0 22 | import Orbital.ProcessLauncherService 1.0 23 | 24 | Element { 25 | width: 200 26 | height: 32 27 | 28 | Layout.minimumWidth: 10 29 | Layout.preferredWidth: 200 30 | Layout.preferredHeight: 30 31 | 32 | contentItem: Rectangle { 33 | color: "white" 34 | anchors.fill: parent 35 | anchors.margins: 2 36 | 37 | ActiveRegion { 38 | anchors.fill: parent 39 | } 40 | 41 | TextInput { 42 | id: text 43 | anchors.fill: parent 44 | anchors.margins: 2 45 | verticalAlignment: TextInput.AlignVCenter 46 | clip: true 47 | 48 | onAccepted: { 49 | ProcessLauncher.launch(text.text) 50 | text.text = "" 51 | } 52 | Keys.onPressed: { 53 | if (event.key == Qt.Key_Escape) { 54 | text.text = "" 55 | } 56 | } 57 | } 58 | 59 | MouseArea { 60 | anchors.fill: parent 61 | cursorShape: Qt.IBeamCursor 62 | onPressed: { 63 | mouse.accepted = false; 64 | } 65 | } 66 | } 67 | 68 | toolTip: Text { 69 | width: 150 70 | height: 40 71 | horizontalAlignment: Qt.AlignHCenter 72 | verticalAlignment: Qt.AlignVCenter 73 | elide: Text.ElideMiddle 74 | color: CurrentStyle.textColor 75 | text: qsTr("Run command") 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/client/elements/runner/element: -------------------------------------------------------------------------------- 1 | { 2 | "prettyName": "Runner", 3 | "qmlFile": "Runner.qml" 4 | } 5 | -------------------------------------------------------------------------------- /src/client/elements/runner/it_IT.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Runner 6 | 7 | 8 | Run command 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/client/elements/systray/element: -------------------------------------------------------------------------------- 1 | { 2 | "prettyName": "System tray", 3 | "qmlFile": "main.qml" 4 | } 5 | -------------------------------------------------------------------------------- /src/client/elements/taskbar/element: -------------------------------------------------------------------------------- 1 | { 2 | "prettyName": "Taskbar", 3 | "qmlFile": "TaskBar.qml" 4 | } 5 | -------------------------------------------------------------------------------- /src/client/elements/taskbar/it_IT.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | TaskBarItem 6 | 7 | 8 | Close 9 | Chiudi 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/client/filebrowser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef FILEBROWSER_H 21 | #define FILEBROWSER_H 22 | 23 | #include 24 | #include 25 | 26 | class FileInfo : public QObject 27 | { 28 | Q_OBJECT 29 | Q_PROPERTY(QString name READ name NOTIFY nameChanged) 30 | public: 31 | FileInfo(const QString &file); 32 | 33 | QString name() const; 34 | 35 | Q_INVOKABLE bool isDir() const; 36 | Q_INVOKABLE QString path() const; 37 | 38 | signals: 39 | void nameChanged(); 40 | 41 | private: 42 | QFileInfo m_info; 43 | }; 44 | 45 | class FileBrowser : public QObject 46 | { 47 | Q_OBJECT 48 | Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged) 49 | Q_PROPERTY(QStringList nameFilters READ nameFilters WRITE setNameFilters) 50 | Q_PROPERTY(QQmlListProperty dirContent READ dirContent NOTIFY pathChanged) 51 | public: 52 | FileBrowser(QObject *p = nullptr); 53 | 54 | void setPath(const QString &path); 55 | void setNameFilters(const QStringList &filters); 56 | 57 | QString path() const; 58 | QStringList nameFilters() const; 59 | QQmlListProperty dirContent(); 60 | 61 | public slots: 62 | void cdUp(); 63 | void cd(const QString &dir); 64 | void cdHome(); 65 | 66 | signals: 67 | void pathChanged(); 68 | 69 | private: 70 | void rebuildFilesList(); 71 | static int filesCount(QQmlListProperty *prop); 72 | static FileInfo *fileAt(QQmlListProperty *prop, int index); 73 | 74 | QDir m_dir; 75 | QList m_files; 76 | }; 77 | 78 | #endif 79 | -------------------------------------------------------------------------------- /src/client/grab.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #include 21 | 22 | #include "wayland-desktop-shell-client-protocol.h" 23 | 24 | #include "grab.h" 25 | #include "utils.h" 26 | #include "client.h" 27 | 28 | Grab::Grab(desktop_shell_grab *g) 29 | : QObject() 30 | , m_grab(g) 31 | { 32 | desktop_shell_grab_add_listener(g, &s_desktop_shell_grab_listener, this); 33 | } 34 | 35 | Grab::~Grab() 36 | { 37 | desktop_shell_grab_destroy(m_grab); 38 | } 39 | 40 | void Grab::end() 41 | { 42 | desktop_shell_grab_end(m_grab); 43 | } 44 | 45 | void Grab::handleEnded(desktop_shell_grab *grab) 46 | { 47 | emit ended(); 48 | } 49 | 50 | void Grab::handleFocus(desktop_shell_grab *grab, wl_surface *surface, wl_fixed_t x, wl_fixed_t y) 51 | { 52 | emit focus(Client::client()->findWindow(surface), wl_fixed_to_int(x), wl_fixed_to_int(y)); 53 | } 54 | 55 | void Grab::handleMotion(desktop_shell_grab *grab, uint32_t time, wl_fixed_t x, wl_fixed_t y) 56 | { 57 | emit motion(time, wl_fixed_to_int(x), wl_fixed_to_int(y)); 58 | } 59 | 60 | void Grab::handleButton(desktop_shell_grab *grab, uint32_t time , uint32_t btn, uint32_t state) 61 | { 62 | emit button(time, btn, state); 63 | } 64 | 65 | const struct desktop_shell_grab_listener Grab::s_desktop_shell_grab_listener = { 66 | wrapInterface(&Grab::handleEnded), 67 | wrapInterface(&Grab::handleFocus), 68 | wrapInterface(&Grab::handleMotion), 69 | wrapInterface(&Grab::handleButton) 70 | }; 71 | -------------------------------------------------------------------------------- /src/client/grab.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef GRAB_H 21 | #define GRAB_H 22 | 23 | #include 24 | 25 | #include 26 | 27 | class QQuickWindow; 28 | 29 | struct desktop_shell_grab; 30 | struct desktop_shell_grab_listener; 31 | 32 | class Grab : public QObject 33 | { 34 | Q_OBJECT 35 | public: 36 | Grab(desktop_shell_grab *grab); 37 | ~Grab(); 38 | 39 | public slots: 40 | void end(); 41 | 42 | signals: 43 | void ended(); 44 | void focus(QQuickWindow *window, int x, int y); 45 | void motion(uint32_t time, int x, int y); 46 | void button(uint32_t time, uint32_t button, uint32_t state); 47 | 48 | private: 49 | void handleEnded(desktop_shell_grab *grab); 50 | void handleFocus(desktop_shell_grab *grab, wl_surface *surface, wl_fixed_t x, wl_fixed_t y); 51 | void handleMotion(desktop_shell_grab *grab, uint32_t time, wl_fixed_t x, wl_fixed_t y); 52 | void handleButton(desktop_shell_grab *grab, uint32_t time , uint32_t button, uint32_t state); 53 | static const desktop_shell_grab_listener s_desktop_shell_grab_listener; 54 | 55 | desktop_shell_grab *m_grab; 56 | }; 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /src/client/iconimageprovider.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #include 21 | #include 22 | 23 | #include "iconimageprovider.h" 24 | 25 | IconImageProvider::IconImageProvider() 26 | : QQuickImageProvider(QQuickImageProvider::Pixmap) 27 | { 28 | } 29 | 30 | QPixmap IconImageProvider::requestPixmap(const QString &id, QSize *realSize, const QSize &requestedSize) 31 | { 32 | QSize size(requestedSize); 33 | if (size.width() < 1) size.setWidth(1); 34 | if (size.height() < 1) size.setHeight(1); 35 | QIcon icon = QIcon::fromTheme(id); 36 | if (icon.isNull()) { 37 | icon = QIcon::fromTheme(QStringLiteral("image-missing")); 38 | } 39 | *realSize = size; 40 | 41 | return icon.pixmap(size); 42 | } 43 | -------------------------------------------------------------------------------- /src/client/iconimageprovider.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef ICONIMAGEPROVIDER_H 21 | #define ICONIMAGEPROVIDER_H 22 | 23 | #include 24 | 25 | class IconImageProvider : public QQuickImageProvider 26 | { 27 | public: 28 | IconImageProvider(); 29 | 30 | QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize); 31 | }; 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/client/keysequence.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef ORBITAL_CLIENT_KEYSEQUENCE_H 21 | #define ORBITAL_CLIENT_KEYSEQUENCE_H 22 | 23 | #include 24 | 25 | class KeySequence 26 | { 27 | public: 28 | explicit KeySequence(const QString &sequence); 29 | 30 | bool isValid() const { return m_valid; } 31 | Qt::KeyboardModifiers modifiers() const { return m_mods; } 32 | int key() const { return m_key; } 33 | 34 | private: 35 | bool m_valid; 36 | Qt::KeyboardModifiers m_mods; 37 | int m_key; 38 | }; 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /src/client/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #include 21 | 22 | #include 23 | 24 | #include "client.h" 25 | 26 | int main(int argc, char *argv[]) 27 | { 28 | setenv("QT_WAYLAND_USE_BYPASSWINDOWMANAGERHINT", "1", 1); 29 | 30 | QApplication app(argc, argv); 31 | Client client; 32 | 33 | return app.exec(); 34 | } 35 | -------------------------------------------------------------------------------- /src/client/notification.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #include 21 | #include 22 | 23 | #include "notification.h" 24 | #include "client.h" 25 | #include "wayland-desktop-shell-client-protocol.h" 26 | 27 | NotificationWindow::NotificationWindow(QObject *p) 28 | : QObject(p) 29 | , m_window(new QQuickWindow) 30 | , m_contentItem(nullptr) 31 | , m_inactive(false) 32 | , m_surface(nullptr) 33 | { 34 | m_window->setFlags(Qt::BypassWindowManagerHint); 35 | m_window->setColor(Qt::transparent); 36 | m_window->create(); 37 | } 38 | 39 | NotificationWindow::~NotificationWindow() 40 | { 41 | notification_surface_destroy(m_surface); 42 | delete m_window; 43 | } 44 | 45 | QQuickItem *NotificationWindow::contentItem() const 46 | { 47 | return m_contentItem; 48 | } 49 | 50 | void NotificationWindow::setContentItem(QQuickItem *item) 51 | { 52 | if (m_contentItem) { 53 | return; 54 | } 55 | 56 | m_contentItem = item; 57 | if (item) { 58 | item->setParentItem(m_window->contentItem()); 59 | m_window->setWidth(item->width()); 60 | m_window->setHeight(item->height()); 61 | m_window->show(); 62 | m_surface = Client::client()->pushNotification(m_window, m_inactive); 63 | connect(item, &QQuickItem::widthChanged, this, &NotificationWindow::resetWidth); 64 | connect(item, &QQuickItem::heightChanged, this, &NotificationWindow::resetHeight); 65 | } 66 | } 67 | 68 | bool NotificationWindow::inactive() const 69 | { 70 | return m_inactive; 71 | } 72 | 73 | void NotificationWindow::setInactive(bool in) 74 | { 75 | m_inactive = in; 76 | } 77 | 78 | void NotificationWindow::resetWidth() 79 | { 80 | m_window->setWidth(m_contentItem->width()); 81 | } 82 | 83 | void NotificationWindow::resetHeight() 84 | { 85 | m_window->setHeight(m_contentItem->height()); 86 | } -------------------------------------------------------------------------------- /src/client/notification.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef NOTIFICATION_H 21 | #define NOTIFICATION_H 22 | 23 | #include 24 | 25 | class QQuickWindow; 26 | class QQuickItem; 27 | 28 | struct notification_surface; 29 | 30 | class NotificationWindow : public QObject 31 | { 32 | Q_OBJECT 33 | Q_PROPERTY(bool inactive READ inactive WRITE setInactive) 34 | Q_PROPERTY(QQuickItem *contentItem READ contentItem WRITE setContentItem) 35 | Q_CLASSINFO("DefaultProperty", "contentItem") 36 | public: 37 | explicit NotificationWindow(QObject *p = nullptr); 38 | ~NotificationWindow(); 39 | 40 | QQuickItem *contentItem() const; 41 | void setContentItem(QQuickItem *item); 42 | bool inactive() const; 43 | void setInactive(bool inactive); 44 | 45 | private: 46 | void resetWidth(); 47 | void resetHeight(); 48 | 49 | QQuickWindow *m_window; 50 | QQuickItem *m_contentItem; 51 | bool m_inactive; 52 | notification_surface *m_surface; 53 | }; 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /src/client/panel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef PANEL_H 21 | #define PANEL_H 22 | 23 | #include 24 | 25 | #include "element.h" 26 | 27 | class QScreen; 28 | 29 | struct desktop_shell_panel; 30 | struct desktop_shell_panel_listener; 31 | 32 | class Element; 33 | 34 | class Panel : public QQuickWindow 35 | { 36 | Q_OBJECT 37 | public: 38 | Panel(QScreen *screen, Element *elm); 39 | ~Panel(); 40 | 41 | void move(); 42 | void setLocation(Element::Location loc); 43 | 44 | private: 45 | void locationChanged(desktop_shell_panel *panel, uint32_t loc); 46 | 47 | desktop_shell_panel *m_panel; 48 | Element *m_element; 49 | 50 | static const desktop_shell_panel_listener s_listener; 51 | }; 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /src/client/popup.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef POPUP_H 21 | #define POPUP_H 22 | 23 | #include 24 | 25 | class QQuickItem; 26 | class QQuickWindow; 27 | 28 | struct desktop_shell_surface; 29 | struct desktop_shell_surface_listener; 30 | 31 | class Popup : public QObject 32 | { 33 | Q_OBJECT 34 | Q_PROPERTY(QQuickItem *parentItem READ parentItem WRITE setParentItem) 35 | Q_PROPERTY(bool visible READ visible WRITE setVisible NOTIFY visibleChanged) 36 | Q_PROPERTY(QQuickItem *content READ content WRITE setContent) 37 | public: 38 | Popup(QObject *parent = nullptr); 39 | ~Popup(); 40 | 41 | QQuickItem *parentItem() const { return m_parent; } 42 | void setParentItem(QQuickItem *i) { m_parent = i; } 43 | 44 | bool visible() const; 45 | void setVisible(bool v); 46 | 47 | QQuickItem *content() const { return m_content; } 48 | void setContent(QQuickItem *c); 49 | 50 | public slots: 51 | void show(); 52 | void hide(); 53 | 54 | signals: 55 | void visibleChanged(); 56 | 57 | private slots: 58 | void hideEvent(); 59 | 60 | private: 61 | void close(desktop_shell_surface *s); 62 | void contentWidthChanged(); 63 | void contentHeightChanged(); 64 | 65 | QQuickWindow *m_window; 66 | QQuickItem *m_parent; 67 | QQuickItem *m_content; 68 | desktop_shell_surface *m_shsurf; 69 | 70 | static const desktop_shell_surface_listener m_shsurf_listener; 71 | }; 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /src/client/qml/Button.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | import QtQuick 2.1 21 | import QtGraphicalEffects 1.0 22 | import Orbital 1.0 23 | 24 | Item { 25 | id: button 26 | 27 | width: 30 28 | height: 15 29 | 30 | signal clicked() 31 | property string caption: "" 32 | 33 | StyleItem { 34 | id: style 35 | anchors.fill: parent 36 | component: CurrentStyle.button 37 | 38 | Binding { target: style.item; property: "text"; value: button.caption } 39 | Binding { target: style.item; property: "pressed"; value: mouseArea.pressedButtons & Qt.LeftButton } 40 | } 41 | 42 | MouseArea { 43 | id: mouseArea 44 | anchors.fill: parent 45 | acceptedButtons: Qt.LeftButton 46 | } 47 | 48 | Component.onCompleted: { 49 | mouseArea.clicked.connect(clicked) 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/client/qml/Element.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | import QtQuick 2.1 21 | import QtQuick.Controls 1.0 as Controls 22 | import QtGraphicalEffects 1.0 23 | import Orbital 1.0 24 | 25 | ElementBase { 26 | property alias toolTip: tt.content 27 | 28 | content: MouseArea { 29 | anchors.fill: parent 30 | hoverEnabled: true 31 | 32 | ToolTip { 33 | id: tooltipWindow 34 | anchors.fill: parent 35 | 36 | property Item c: StyleItem { 37 | id: tt 38 | component: CurrentStyle.toolTipBackground 39 | property Item content: null 40 | 41 | Binding { target: tt.content; property: "parent"; value: tt } 42 | Binding { target: tt; property: "width"; value: tt.content ? tt.content.width: 0 } 43 | Binding { target: tt; property: "height"; value: tt.content ? tt.content.height: 0 } 44 | } 45 | 46 | content: tt.content ? c : null 47 | } 48 | 49 | onEntered: { 50 | tooltipWindow.show(); 51 | } 52 | onExited: { 53 | tooltipWindow.hide(); 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/client/qml/Icon.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | import QtQuick 2.1 21 | import QtQuick.Layouts 1.0 22 | import QtGraphicalEffects 1.0 23 | 24 | Item { 25 | id: button 26 | 27 | width: 32 28 | height: width 29 | 30 | signal clicked() 31 | signal pressed() 32 | signal entered() 33 | property string icon: "" 34 | property alias cache: image.cache 35 | property int iconFillMode: Image.PreserveAspectFit 36 | readonly property bool containsMouse: mouseArea.containsMouse 37 | 38 | Item { 39 | id: icon 40 | anchors.fill: parent 41 | 42 | Image { 43 | id: image 44 | source: button.icon 45 | anchors.fill: parent 46 | sourceSize: Qt.size(32, 32) 47 | fillMode: button.iconFillMode 48 | } 49 | 50 | BrightnessContrast { 51 | id: glow 52 | anchors.fill: image 53 | source: image 54 | brightness: 0.3 55 | opacity: 0 56 | cached: true 57 | 58 | Behavior on opacity { PropertyAnimation {} } 59 | } 60 | 61 | states: [ 62 | State { 63 | name: "released" 64 | PropertyChanges { target: icon; anchors.margins: 0 } 65 | }, 66 | State { 67 | name: "pressed" 68 | when: mouseArea.pressed 69 | PropertyChanges { target: icon; anchors.margins: 1 } 70 | } 71 | ] 72 | 73 | transitions: Transition { NumberAnimation { properties: "anchors.margins"; duration: 80 } } 74 | } 75 | 76 | MouseArea { 77 | id: mouseArea 78 | anchors.fill: parent 79 | hoverEnabled: true 80 | propagateComposedEvents: true 81 | 82 | onEntered: { button.entered(); glow.opacity = 1 } 83 | onExited: glow.opacity = 0 84 | onPressed: button.pressed() 85 | onClicked: { mouse.accepted = false; button.clicked() } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /src/client/qml/Spacer.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | import QtQuick 2.1 21 | import Orbital 1.0 22 | 23 | Element { 24 | id: spacer 25 | Layout.fillHeight: true 26 | Layout.fillWidth: true 27 | Layout.preferredWidth: 0 28 | Layout.preferredHeight: 0 29 | } 30 | -------------------------------------------------------------------------------- /src/client/resources.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | qml/Icon.qml 5 | qml/ElementConfiguration.qml 6 | qml/ElementsChooser.qml 7 | qml/Spacer.qml 8 | qml/Element.qml 9 | qml/Button.qml 10 | qml/Rotator.qml 11 | qml/PopupElement.qml 12 | qml/Notifications.qml 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/client/services/datetime/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | find_package(Qt5Core) 3 | find_package(Qt5DBus) 4 | 5 | include_directories( 6 | ${CMAKE_CURRENT_SOURCE_DIR}/../.. 7 | ) 8 | 9 | set(SOURCES datetime.cpp) 10 | 11 | add_library(datetime SHARED ${SOURCES}) 12 | qt5_use_modules(datetime Core Qml) 13 | 14 | set(dest lib/orbital/qml/Orbital/DateTimeService) 15 | install(TARGETS datetime DESTINATION ${dest}) 16 | install(FILES qmldir DESTINATION ${dest}) 17 | -------------------------------------------------------------------------------- /src/client/services/datetime/datetime.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #include "datetime.h" 21 | 22 | #include 23 | #include 24 | 25 | void DateTimePlugin::registerTypes(const char *uri) 26 | { 27 | qmlRegisterSingletonType(uri, 1, 0, "DateTime", [](QQmlEngine *, QJSEngine *) { 28 | return static_cast(new DateTime); 29 | }); 30 | } 31 | 32 | 33 | DateTime::DateTime(QObject *p) 34 | : QObject(p) 35 | { 36 | startTimer(250); 37 | 38 | setDT(QDateTime::currentDateTime()); 39 | } 40 | 41 | DateTime::~DateTime() 42 | { 43 | 44 | } 45 | 46 | QString DateTime::time() const 47 | { 48 | return m_dateTime.time().toString(); 49 | } 50 | 51 | QString DateTime::date() const 52 | { 53 | return m_dateTime.date().toString(Qt::DefaultLocaleShortDate); 54 | } 55 | 56 | void DateTime::timerEvent(QTimerEvent *event) 57 | { 58 | QDateTime dt = QDateTime::currentDateTime(); 59 | if (dt.toTime_t() != m_nsecs) { 60 | setDT(dt); 61 | } 62 | } 63 | 64 | void DateTime::setDT(const QDateTime &dt) 65 | { 66 | QString d = date(); 67 | m_dateTime = dt; 68 | m_nsecs = dt.toTime_t(); 69 | 70 | emit timeChanged(); 71 | if (d != date()) { 72 | emit dateChanged(); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/client/services/datetime/datetime.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef DATETIMESERVICE_H 21 | #define DATETIMESERVICE_H 22 | 23 | #include 24 | #include 25 | 26 | class DateTimePlugin : public QQmlExtensionPlugin 27 | { 28 | Q_OBJECT 29 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") 30 | public: 31 | void registerTypes(const char *uri) override; 32 | }; 33 | 34 | class DateTime : public QObject 35 | { 36 | Q_OBJECT 37 | Q_PROPERTY(QString time READ time NOTIFY timeChanged) 38 | Q_PROPERTY(QString date READ date NOTIFY dateChanged) 39 | public: 40 | DateTime(QObject *p = nullptr); 41 | ~DateTime(); 42 | 43 | QString time() const; 44 | QString date() const; 45 | 46 | signals: 47 | void timeChanged(); 48 | void dateChanged(); 49 | 50 | protected: 51 | virtual void timerEvent(QTimerEvent *event) override; 52 | 53 | private: 54 | void setDT(const QDateTime &dt); 55 | 56 | QDateTime m_dateTime; 57 | uint m_nsecs; 58 | }; 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /src/client/services/datetime/qmldir: -------------------------------------------------------------------------------- 1 | module Orbital.DateTimeService 2 | plugin datetime 3 | -------------------------------------------------------------------------------- /src/client/services/hardware/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | option(use_solid "Use the Solid library, if found." 1) 3 | 4 | find_package(Qt5Core) 5 | find_package(Qt5Qml) 6 | if (${use_solid} MATCHES ON) 7 | find_package(KF5Solid) 8 | endif() 9 | 10 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../..) 11 | 12 | set(SOURCES hardwareservice.cpp clibackend.cpp) 13 | 14 | if(${KF5Solid_FOUND}) 15 | get_property(include TARGET KF5::Solid PROPERTY INTERFACE_INCLUDE_DIRECTORIES) 16 | include_directories(${include}) 17 | list(APPEND SOURCES solidbackend.cpp) 18 | list(APPEND defines "USE_SOLID") 19 | list(APPEND libs KF5::Solid) 20 | elseif (${use_solid} MATCHES ON) 21 | message("WARNING: Cannot find KF5 Solid. You can download it from https://projects.kde.org/projects/frameworks/solid/repository\n") 22 | endif() 23 | 24 | add_library(hardwareservice SHARED ${SOURCES}) 25 | qt5_use_modules(hardwareservice Core Qml) 26 | target_link_libraries(hardwareservice ${libs}) 27 | set_target_properties(hardwareservice PROPERTIES COMPILE_DEFINITIONS "${defines}") 28 | set(dest lib/orbital/qml/Orbital/HardwareService) 29 | install(TARGETS hardwareservice DESTINATION ${dest}) 30 | install(FILES qmldir DESTINATION ${dest}) 31 | -------------------------------------------------------------------------------- /src/client/services/hardware/clibackend.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2014 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef CLIBACKEND_H 21 | #define CLIBACKEND_H 22 | 23 | #include "hardwareservice.h" 24 | 25 | class CliDevice : public Device 26 | { 27 | public: 28 | CliDevice(const QString &udi); 29 | 30 | bool umount() override; 31 | bool mount() override; 32 | bool isMounted() const override; 33 | 34 | private: 35 | }; 36 | 37 | class CliBackend : public HardwareManager::Backend 38 | { 39 | public: 40 | static CliBackend *create(HardwareManager *hw); 41 | 42 | private: 43 | CliBackend(HardwareManager *hw); 44 | }; 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /src/client/services/hardware/qmldir: -------------------------------------------------------------------------------- 1 | module Orbital.HardwareService 2 | plugin hardwareservice 3 | -------------------------------------------------------------------------------- /src/client/services/hardware/solidbackend.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2014 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef SOLIDBACKEND_H 21 | #define SOLIDBACKEND_H 22 | 23 | #include 24 | 25 | #include "hardwareservice.h" 26 | 27 | namespace Solid { 28 | class Device; 29 | class Battery; 30 | } 31 | 32 | class SolidDevice : public Device 33 | { 34 | public: 35 | SolidDevice(const QString &udi); 36 | 37 | bool umount() override; 38 | bool mount() override; 39 | bool isMounted() const override; 40 | 41 | private: 42 | Solid::Device m_device; 43 | }; 44 | 45 | class SolidBattery : public Battery 46 | { 47 | public: 48 | SolidBattery(Solid::Battery *b, const QString &udi); 49 | 50 | }; 51 | 52 | class SolidBackend : public HardwareManager::Backend 53 | { 54 | public: 55 | static SolidBackend *create(HardwareManager *hw); 56 | 57 | private: 58 | SolidBackend(HardwareManager *hw); 59 | void add(Solid::Device &device); 60 | }; 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /src/client/services/login/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | option(use_logind "Use Logind to poweroff/reboot the computer." 1) 3 | 4 | find_package(Qt5Core) 5 | if (${use_logind} MATCHES ON) 6 | find_package(Qt5DBus) 7 | endif() 8 | 9 | include_directories( 10 | ${CMAKE_CURRENT_SOURCE_DIR}/../.. 11 | ) 12 | 13 | set(SOURCES loginservice.cpp clibackend.cpp) 14 | 15 | if (${use_logind} MATCHES ON) 16 | list(APPEND SOURCES logindbackend.cpp) 17 | list(APPEND defines "USE_LOGIND") 18 | endif() 19 | 20 | add_library(loginservice SHARED ${SOURCES}) 21 | qt5_use_modules(loginservice Core DBus Qml) 22 | set_target_properties(loginservice PROPERTIES COMPILE_DEFINITIONS "${defines}") 23 | target_link_libraries(loginservice pam) 24 | set(dest lib/orbital/qml/Orbital/LoginService) 25 | install(TARGETS loginservice DESTINATION ${dest}) 26 | install(FILES qmldir DESTINATION ${dest}) 27 | -------------------------------------------------------------------------------- /src/client/services/login/clibackend.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2014 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #include 21 | 22 | #include "clibackend.h" 23 | 24 | CliBackend::CliBackend() 25 | { 26 | 27 | } 28 | 29 | CliBackend::~CliBackend() 30 | { 31 | 32 | } 33 | 34 | CliBackend *CliBackend::create() 35 | { 36 | CliBackend *logind = new CliBackend(); 37 | return logind; 38 | } 39 | 40 | void CliBackend::poweroff() 41 | { 42 | QProcess::execute(QStringLiteral("shutdown -h now")); 43 | } 44 | 45 | void CliBackend::reboot() 46 | { 47 | QProcess::execute(QStringLiteral("shutdown -r now")); 48 | } 49 | -------------------------------------------------------------------------------- /src/client/services/login/clibackend.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2014 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef CLIBACKEND 21 | #define CLIBACKEND 22 | 23 | #include "loginservice.h" 24 | 25 | class CliBackend : public LoginManagerBackend 26 | { 27 | public: 28 | ~CliBackend(); 29 | static CliBackend *create(); 30 | 31 | void poweroff() override; 32 | void reboot() override; 33 | 34 | private: 35 | CliBackend(); 36 | }; 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /src/client/services/login/logindbackend.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2014 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef LOGINDBACKEND_H 21 | #define LOGINDBACKEND_H 22 | 23 | #include "loginservice.h" 24 | 25 | class QDBusPendingCallWatcher; 26 | 27 | class DBusInterface; 28 | 29 | class LogindBackend : public LoginManagerBackend 30 | { 31 | Q_OBJECT 32 | public: 33 | ~LogindBackend(); 34 | static LogindBackend *create(); 35 | 36 | void poweroff() override; 37 | void reboot() override; 38 | void locked() override; 39 | void unlocked() override; 40 | 41 | private slots: 42 | void prepareForSleep(bool v); 43 | 44 | private: 45 | LogindBackend(); 46 | void takeSleepLock(); 47 | void getSession(QDBusPendingCallWatcher *watcher); 48 | 49 | DBusInterface *m_interface; 50 | QString m_sessionPath; 51 | int m_inhibitFd; 52 | }; 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /src/client/services/login/qmldir: -------------------------------------------------------------------------------- 1 | module Orbital.LoginService 2 | plugin loginservice 3 | -------------------------------------------------------------------------------- /src/client/services/mixer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | option(use_pulseaudio "Use Pulseaudio, if found." 1) 3 | option(use_alsa "Use the Alsa library, if found." 1) 4 | 5 | find_package(Qt5Core) 6 | if (${use_alsa} MATCHES ON) 7 | find_package(ALSA) 8 | endif() 9 | if (${use_pulseaudio} MATCHES ON) 10 | pkg_check_modules(pulse libpulse) 11 | pkg_check_modules(pulse-glib libpulse-mainloop-glib) 12 | endif() 13 | 14 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../..) 15 | 16 | set(SOURCES mixerservice.cpp) 17 | if (${ALSA_FOUND}) 18 | list(APPEND SOURCES alsamixer.cpp) 19 | endif() 20 | 21 | if (${pulse_FOUND}) 22 | list(APPEND SOURCES pulseaudiomixer.cpp) 23 | endif() 24 | 25 | add_library(mixerservice SHARED ${SOURCES}) 26 | qt5_use_modules(mixerservice Core Qml) 27 | 28 | if (${ALSA_FOUND}) 29 | include_directories("${ALSA_INCLUDE_DIR}") 30 | list(APPEND defines "HAVE_ALSA") 31 | target_link_libraries(mixerservice ${ALSA_LIBRARIES}) 32 | elseif (${use_alsa} MATCHES ON) 33 | message("\nCannot find Alsa\n") 34 | endif() 35 | 36 | if (${pulse_FOUND}) 37 | include_directories(${pulse-glib_INCLUDE_DIRS}) 38 | list(APPEND defines "HAVE_PULSE") 39 | target_link_libraries(mixerservice ${pulse_LIBRARIES} ${pulse-glib_LIBRARIES}) 40 | elseif (${use_pulseaudio} MATCHES ON) 41 | message("\nCannot find Pulseaudio\n") 42 | endif() 43 | 44 | target_link_libraries(mixerservice) 45 | 46 | set(dest lib/orbital/qml/Orbital/MixerService) 47 | set_target_properties(mixerservice PROPERTIES COMPILE_DEFINITIONS "${defines}") 48 | install(TARGETS mixerservice DESTINATION ${dest}) 49 | install(FILES qmldir DESTINATION ${dest}) 50 | -------------------------------------------------------------------------------- /src/client/services/mixer/alsamixer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef ALSAMIXER_H 21 | #define ALSAMIXER_H 22 | 23 | #include 24 | 25 | #include "mixerservice.h" 26 | 27 | class AlsaMixer : public Backend 28 | { 29 | public: 30 | ~AlsaMixer(); 31 | 32 | static AlsaMixer *create(Mixer *mixer); 33 | 34 | void getBoundaries(int *min, int *max) const override; 35 | 36 | int rawVol() const override; 37 | void setRawVol(int vol) override; 38 | bool muted() const override; 39 | void setMuted(bool muted) override; 40 | 41 | private: 42 | AlsaMixer(Mixer *mixer); 43 | 44 | Mixer *m_mixer; 45 | snd_mixer_t *m_handle; 46 | snd_mixer_selem_id_t *m_sid; 47 | snd_mixer_elem_t *m_elem; 48 | long m_min; 49 | long m_max; 50 | }; 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /src/client/services/mixer/mixerservice.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef VOLUMECONTROL_H 21 | #define VOLUMECONTROL_H 22 | 23 | #include 24 | 25 | class MixerPlugin : public QQmlExtensionPlugin 26 | { 27 | Q_OBJECT 28 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") 29 | public: 30 | void registerTypes(const char *uri) override; 31 | }; 32 | 33 | class Backend 34 | { 35 | public: 36 | virtual ~Backend() {} 37 | 38 | virtual void getBoundaries(int *min, int *max) const = 0; 39 | virtual int rawVol() const = 0; 40 | virtual void setRawVol(int vol) = 0; 41 | virtual bool muted() const = 0; 42 | virtual void setMuted(bool muted) = 0; 43 | }; 44 | 45 | class Mixer : public QObject 46 | { 47 | Q_OBJECT 48 | Q_PROPERTY(int master READ master WRITE setMaster NOTIFY masterChanged); 49 | Q_PROPERTY(bool muted READ muted WRITE setMuted NOTIFY mutedChanged) 50 | public: 51 | Mixer(QObject *p = nullptr); 52 | ~Mixer(); 53 | 54 | int master() const; 55 | bool muted() const; 56 | void setMuted(bool muted); 57 | 58 | public slots: 59 | void increaseMaster(); 60 | void decreaseMaster(); 61 | void setMaster(int master); 62 | void changeMaster(int change); 63 | void toggleMuted(); 64 | 65 | signals: 66 | void masterChanged(); 67 | void mutedChanged(); 68 | void bindingTriggered(); 69 | 70 | private: 71 | int m_min; 72 | int m_max; 73 | int m_step; 74 | 75 | Backend *m_backend; 76 | }; 77 | 78 | #endif 79 | -------------------------------------------------------------------------------- /src/client/services/mixer/pulseaudiomixer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2014 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef PULSEAUDIOMIXER_H 21 | #define PULSEAUDIOMIXER_H 22 | 23 | #include 24 | 25 | #include "mixerservice.h" 26 | 27 | struct pa_glib_mainloop; 28 | 29 | struct Sink; 30 | 31 | class PulseAudioMixer : public Backend 32 | { 33 | public: 34 | ~PulseAudioMixer(); 35 | 36 | static PulseAudioMixer *create(Mixer *mixer); 37 | 38 | void getBoundaries(int *min, int *max) const override; 39 | 40 | int rawVol() const override; 41 | void setRawVol(int vol) override; 42 | bool muted() const override; 43 | void setMuted(bool muted) override; 44 | 45 | private: 46 | PulseAudioMixer(Mixer *mixer); 47 | void contextStateCallback(pa_context *c); 48 | void subscribeCallback(pa_context *c, pa_subscription_event_type_t t, uint32_t index); 49 | void sinkCallback(pa_context *c, const pa_sink_info *i, int eol); 50 | void cleanup(); 51 | 52 | Mixer *m_mixer; 53 | pa_glib_mainloop *m_mainLoop; 54 | pa_mainloop_api *m_mainloopApi; 55 | pa_context *m_context; 56 | Sink *m_sink; 57 | }; 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /src/client/services/mixer/qmldir: -------------------------------------------------------------------------------- 1 | module Orbital.MixerService 2 | plugin mixerservice 3 | -------------------------------------------------------------------------------- /src/client/services/mpris/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | find_package(Qt5Core) 3 | find_package(Qt5Qml) 4 | find_package(Qt5DBus) 5 | 6 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../..) 7 | 8 | set(SOURCES mprisservice.cpp) 9 | 10 | add_library(mprisservice SHARED ${SOURCES}) 11 | qt5_use_modules(mprisservice Core Qml DBus) 12 | 13 | target_link_libraries(mprisservice) 14 | 15 | set(dest lib/orbital/qml/Orbital/MprisService) 16 | set_target_properties(mprisservice PROPERTIES COMPILE_DEFINITIONS "${defines}") 17 | install(TARGETS mprisservice DESTINATION ${dest}) 18 | install(FILES qmldir DESTINATION ${dest}) 19 | -------------------------------------------------------------------------------- /src/client/services/mpris/qmldir: -------------------------------------------------------------------------------- 1 | module Orbital.MprisService 2 | plugin mprisservice 3 | -------------------------------------------------------------------------------- /src/client/services/notifications/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | find_package(Qt5Core) 3 | find_package(Qt5DBus) 4 | 5 | include_directories( 6 | ${CMAKE_CURRENT_SOURCE_DIR}/../.. 7 | ) 8 | 9 | set(SOURCES notificationsservice.cpp notificationsadaptor.cpp notificationsiconprovider.cpp) 10 | 11 | add_library(notificationsservice SHARED ${SOURCES}) 12 | qt5_use_modules(notificationsservice Core DBus Quick) 13 | set_target_properties(notificationsservice PROPERTIES COMPILE_DEFINITIONS "${defines}") 14 | set(dest lib/orbital/qml/Orbital/NotificationsService) 15 | install(TARGETS notificationsservice DESTINATION ${dest}) 16 | install(FILES qmldir DESTINATION ${dest}) 17 | -------------------------------------------------------------------------------- /src/client/services/notifications/notificationsiconprovider.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #include "notificationsiconprovider.h" 25 | #include "notificationsservice.h" 26 | 27 | NotificationsIconProvider::NotificationsIconProvider(NotificationsManager *service) 28 | : QQuickImageProvider(QQuickImageProvider::Pixmap) 29 | , m_service(service) 30 | { 31 | } 32 | 33 | QPixmap NotificationsIconProvider::requestPixmap(const QString &id, QSize *realSize, const QSize &requestedSize) 34 | { 35 | QSize size(requestedSize); 36 | if (size.width() < 1) size.setWidth(1); 37 | if (size.height() < 1) size.setHeight(1); 38 | 39 | *realSize = size; 40 | 41 | int i = id.toInt(); 42 | Notification *notification = m_service->notification(i); 43 | 44 | QPixmap image = notification->iconImage(); 45 | if (!image.isNull()) { 46 | *realSize = image.size(); 47 | return image; 48 | } 49 | 50 | QString iconName = notification->iconName(); 51 | if (!iconName.isEmpty()) { 52 | QIcon icon = QIcon::fromTheme(iconName); 53 | if (!icon.isNull()) { 54 | return icon.pixmap(size); 55 | } 56 | qDebug("Cannot find the requested notification icon: \"%s\".", qPrintable(iconName)); 57 | } 58 | 59 | return QIcon::fromTheme(QStringLiteral("dialog-information")).pixmap(size); 60 | } 61 | -------------------------------------------------------------------------------- /src/client/services/notifications/notificationsiconprovider.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef NOTIFICATIONICONPROVIDER_H 21 | #define NOTIFICATIONICONPROVIDER_H 22 | 23 | #include 24 | 25 | class NotificationsManager; 26 | 27 | class NotificationsIconProvider : public QQuickImageProvider 28 | { 29 | public: 30 | explicit NotificationsIconProvider(NotificationsManager *service); 31 | 32 | QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize); 33 | 34 | private: 35 | NotificationsManager *m_service; 36 | }; 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /src/client/services/notifications/notificationsservice.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef NOTIFICATIONSSERVICE_H 21 | #define NOTIFICATIONSSERVICE_H 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | class NotificationsPlugin : public QQmlExtensionPlugin 28 | { 29 | Q_OBJECT 30 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") 31 | public: 32 | void registerTypes(const char *uri) override; 33 | }; 34 | 35 | class Notification : public QObject 36 | { 37 | Q_OBJECT 38 | Q_PROPERTY(int id READ id CONSTANT) 39 | Q_PROPERTY(QString summary READ summary CONSTANT) 40 | Q_PROPERTY(QString body READ body CONSTANT) 41 | 42 | public: 43 | Notification(); 44 | 45 | int id() const { return m_id; } 46 | QString summary() const { return m_summary; } 47 | QString body() const { return m_body; } 48 | QString iconName() const { return m_iconName; } 49 | QPixmap iconImage() const { return m_iconImage; } 50 | 51 | void setId(int id); 52 | void setSummary(const QString &s); 53 | void setBody(const QString &body); 54 | void setIconName(const QString &icon); 55 | void setIconImage(const QPixmap &img); 56 | 57 | protected: 58 | void timerEvent(QTimerEvent *e); 59 | 60 | signals: 61 | void expired(); 62 | 63 | private: 64 | int m_id; 65 | QString m_summary; 66 | QString m_body; 67 | QString m_iconName; 68 | QPixmap m_iconImage; 69 | }; 70 | 71 | class NotificationsManager : public QObject 72 | { 73 | Q_OBJECT 74 | public: 75 | NotificationsManager(QObject *p = nullptr); 76 | ~NotificationsManager(); 77 | 78 | void newNotification(Notification *notification); 79 | 80 | Notification *notification(int id) const; 81 | 82 | signals: 83 | void notify(Notification *notification); 84 | 85 | private: 86 | QHash m_notifications; 87 | }; 88 | 89 | #endif 90 | -------------------------------------------------------------------------------- /src/client/services/notifications/org.freedesktop.Notifications.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /src/client/services/notifications/qmldir: -------------------------------------------------------------------------------- 1 | module Orbital.NotificationsService 2 | plugin notificationsservice -------------------------------------------------------------------------------- /src/client/services/processlauncher/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | find_package(Qt5Core) 3 | 4 | include_directories( 5 | ${CMAKE_CURRENT_SOURCE_DIR}/../.. 6 | ) 7 | 8 | set(SOURCES processlauncher.cpp) 9 | 10 | add_library(processlauncher SHARED ${SOURCES}) 11 | qt5_use_modules(processlauncher Core Qml) 12 | set(dest lib/orbital/qml/Orbital/ProcessLauncherService) 13 | install(TARGETS processlauncher DESTINATION ${dest}) 14 | install(FILES qmldir DESTINATION ${dest}) 15 | -------------------------------------------------------------------------------- /src/client/services/processlauncher/processlauncher.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef PROCESSLAUNCHER_H 21 | #define PROCESSLAUNCHER_H 22 | 23 | #include 24 | #include 25 | 26 | class ProcessLauncherPlugin : public QQmlExtensionPlugin 27 | { 28 | Q_OBJECT 29 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") 30 | public: 31 | void registerTypes(const char *uri) override; 32 | }; 33 | 34 | class ProcessLauncher : public QObject 35 | { 36 | Q_OBJECT 37 | public: 38 | ProcessLauncher(QObject *p = nullptr); 39 | 40 | public slots: 41 | void launch(const QString &process); 42 | 43 | }; 44 | 45 | class Process : public QObject 46 | { 47 | Q_OBJECT 48 | Q_PROPERTY(State state READ state NOTIFY stateChanged) 49 | public: 50 | enum class State { 51 | NotRunning = 0, 52 | Starting = 1, 53 | Running = 2 54 | }; 55 | Q_ENUMS(State); 56 | 57 | Process(QObject *p = nullptr); 58 | 59 | State state() const { return m_state; } 60 | 61 | Q_INVOKABLE void start(const QString &process); 62 | Q_INVOKABLE QByteArray readAllStandardOutput(); 63 | Q_INVOKABLE QByteArray readAllStandardError(); 64 | 65 | signals: 66 | void finished(); 67 | void readyReadStandardOutput(); 68 | void readyReadStandardError(); 69 | void stateChanged(); 70 | 71 | private: 72 | QProcess m_process; 73 | State m_state; 74 | }; 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /src/client/services/processlauncher/qmldir: -------------------------------------------------------------------------------- 1 | module Orbital.ProcessLauncherService 2 | plugin processlauncher 3 | -------------------------------------------------------------------------------- /src/client/services/statusnotifier/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | find_package(Qt5Core) 3 | find_package(Qt5DBus) 4 | find_package(Qt5Qml) 5 | 6 | include_directories( 7 | ${CMAKE_CURRENT_SOURCE_DIR}/../.. 8 | ) 9 | 10 | set(SOURCES statusnotifierservice.cpp 11 | statusnotifierwatcher.cpp 12 | statusnotifieritem.cpp 13 | statusnotifiericonprovider.cpp) 14 | 15 | add_library(statusnotifierservice SHARED ${SOURCES}) 16 | qt5_use_modules(statusnotifierservice Core DBus Qml Gui Quick) 17 | set_target_properties(statusnotifierservice PROPERTIES COMPILE_DEFINITIONS "${defines}") 18 | set(dest lib/orbital/qml/Orbital/StatusNotifierService) 19 | install(TARGETS statusnotifierservice DESTINATION ${dest}) 20 | install(FILES qmldir DESTINATION ${dest}) 21 | -------------------------------------------------------------------------------- /src/client/services/statusnotifier/org.kde.StatusNotifierWatcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /src/client/services/statusnotifier/qmldir: -------------------------------------------------------------------------------- 1 | module Orbital.StatusNotifierService 2 | plugin statusnotifierservice 3 | -------------------------------------------------------------------------------- /src/client/services/statusnotifier/statusnotifiericonprovider.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef STATUSNOTIFIERICONPROVIDER_H 21 | #define STATUSNOTIFIERICONPROVIDER_H 22 | 23 | #include 24 | 25 | class StatusNotifierManager; 26 | 27 | class StatusNotifierIconProvider : public QQuickImageProvider 28 | { 29 | public: 30 | StatusNotifierIconProvider(StatusNotifierManager *service); 31 | 32 | QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize); 33 | 34 | private: 35 | StatusNotifierManager *m_service; 36 | }; 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /src/client/services/statusnotifier/statusnotifierservice.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef STATUSNOTIFIERSERVICE_H 21 | #define STATUSNOTIFIERSERVICE_H 22 | 23 | #include 24 | #include 25 | 26 | class StatusNotifierWatcher; 27 | class StatusNotifierItem; 28 | 29 | class StatusNotifierPlugin : public QQmlExtensionPlugin 30 | { 31 | Q_OBJECT 32 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") 33 | public: 34 | void registerTypes(const char *uri) override; 35 | }; 36 | 37 | class StatusNotifierManager : public QObject 38 | { 39 | Q_OBJECT 40 | Q_PROPERTY(QQmlListProperty items READ items NOTIFY itemsChanged) 41 | public: 42 | StatusNotifierManager(QObject *p = nullptr); 43 | ~StatusNotifierManager(); 44 | 45 | StatusNotifierItem *item(const QStringRef &service) const; 46 | QQmlListProperty items(); 47 | 48 | signals: 49 | void itemsChanged(); 50 | 51 | private: 52 | void newItem(const QString &service); 53 | void itemRemoved(); 54 | static int itemsCount(QQmlListProperty *prop); 55 | static StatusNotifierItem *itemAt(QQmlListProperty *prop, int index); 56 | 57 | StatusNotifierWatcher *m_watcher; 58 | QList m_items; 59 | }; 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /src/client/services/statusnotifier/statusnotifierwatcher.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | /* 21 | * This file was originally generated by qdbusxml2cpp version 0.8 22 | * Command line was: qdbusxml2cpp org.kde.StatusNotifierWatcher.xml -a statusnotifierwatcher -c StatusNotifierWatcher 23 | * 24 | * qdbusxml2cpp is Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). 25 | */ 26 | 27 | #include 28 | 29 | #include "statusnotifierwatcher.h" 30 | 31 | StatusNotifierWatcher::StatusNotifierWatcher(QObject *parent) 32 | : QDBusAbstractAdaptor(parent) 33 | { 34 | setAutoRelaySignals(true); 35 | } 36 | 37 | StatusNotifierWatcher::~StatusNotifierWatcher() 38 | { 39 | } 40 | 41 | bool StatusNotifierWatcher::isStatusNotifierHostRegistered() const 42 | { 43 | // we always have an implicit host 44 | return true; 45 | } 46 | 47 | int StatusNotifierWatcher::protocolVersion() const 48 | { 49 | return 0; 50 | } 51 | 52 | QStringList StatusNotifierWatcher::registeredStatusNotifierItems() const 53 | { 54 | //TODO 55 | return QStringList(); 56 | } 57 | 58 | void StatusNotifierWatcher::RegisterStatusNotifierHost(const QString &service) 59 | { 60 | //TODO 61 | } 62 | 63 | void StatusNotifierWatcher::RegisterStatusNotifierItem(const QString &service) 64 | { 65 | emit newItem(service); 66 | } 67 | -------------------------------------------------------------------------------- /src/client/styles/chiaro/style: -------------------------------------------------------------------------------- 1 | { 2 | "qmlFile": "style.qml", 3 | "prettyName": "Chiaro" 4 | } 5 | -------------------------------------------------------------------------------- /src/client/styles/shadow/style: -------------------------------------------------------------------------------- 1 | { 2 | "qmlFile": "style.qml", 3 | "prettyName": "Shadow" 4 | } 5 | -------------------------------------------------------------------------------- /src/client/tooltip.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef TOOLTIP_H 21 | #define TOOLTIP_H 22 | 23 | #include 24 | 25 | class QQuickWindow; 26 | class QTimer; 27 | 28 | struct wl_subsurface; 29 | 30 | class ToolTip : public QQuickItem 31 | { 32 | Q_OBJECT 33 | Q_PROPERTY(QQuickItem *content READ content WRITE setContent) 34 | public: 35 | ToolTip(QQuickItem *parent = nullptr); 36 | 37 | QQuickItem *content() const { return m_content; } 38 | void setContent(QQuickItem *c) { m_content = c; } 39 | 40 | public slots: 41 | void show(); 42 | void hide(); 43 | 44 | protected: 45 | virtual bool eventFilter(QObject *obj, QEvent *event) override; 46 | 47 | private: 48 | void doShow(); 49 | 50 | QQuickWindow *m_window; 51 | QQuickItem *m_content; 52 | QTimer *m_showTimer; 53 | QTimer *m_hideTimer; 54 | wl_subsurface *m_subsurface; 55 | 56 | static int s_showing; 57 | }; 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /src/client/translations/it_IT.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ElementsChooser 6 | 7 | 8 | Style: 9 | Stile: 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/client/uiscreen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef UISCREEN_H 21 | #define UISCREEN_H 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | class QQmlEngine; 30 | class QQuickItem; 31 | class QScreen; 32 | 33 | class Element; 34 | class Client; 35 | class ShellUI; 36 | class Style; 37 | 38 | class UiScreen : public QObject 39 | { 40 | Q_OBJECT 41 | Q_PROPERTY(QRect availableRect READ availableRect NOTIFY availableRectChanged) 42 | Q_PROPERTY(bool loading READ loading NOTIFY loaded) 43 | public: 44 | UiScreen(ShellUI *ui, Client *client, QScreen *screen, const QString &name); 45 | ~UiScreen(); 46 | 47 | QScreen *screen() const { return m_screen; } 48 | QString name() const { return m_name; } 49 | 50 | void loadConfig(QJsonObject &config); 51 | void saveConfig(QJsonObject &config); 52 | 53 | void addElement(Element *elm); 54 | void removeElement(Element *elm); 55 | 56 | QRect availableRect() const { return m_rect; } 57 | void setAvailableRect(const QRect &r); 58 | 59 | bool loading() const; 60 | 61 | signals: 62 | void availableRectChanged(); 63 | void loaded(); 64 | 65 | private slots: 66 | void screenLoaded(); 67 | 68 | private: 69 | Element *loadElement(Element *parent, QJsonObject &config, QHash *elements); 70 | void saveProperties(QObject *obj, const QStringList &properties, QJsonObject &config); 71 | void saveChildren(const QList &children, QJsonObject &config); 72 | void elementDestroyed(QObject *obj); 73 | 74 | Client *m_client; 75 | ShellUI *m_ui; 76 | QString m_name; 77 | QScreen *m_screen; 78 | QRect m_rect; 79 | bool m_loading; 80 | 81 | QHash m_elements; 82 | QList m_children; 83 | }; 84 | 85 | #endif 86 | -------------------------------------------------------------------------------- /src/client/utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef UTILS_H 21 | #define UTILS_H 22 | 23 | class QWindow; 24 | 25 | struct wl_surface; 26 | 27 | wl_surface *nativeSurface(QWindow *window); 28 | 29 | template 30 | struct Wrapper { 31 | template 32 | static void forward(void *data, Args... args) { 33 | (static_cast(data)->*F)(args...); 34 | } 35 | }; 36 | 37 | template 38 | constexpr static auto createWrapper(void (T::*func)(Args...)) -> Wrapper { 39 | return Wrapper(); 40 | } 41 | 42 | #define wrapInterface(method) createWrapper(method).forward 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /src/client/workspace.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #include 21 | 22 | #include "workspace.h" 23 | #include "wayland-desktop-shell-client-protocol.h" 24 | #include "utils.h" 25 | #include "client.h" 26 | #include "uiscreen.h" 27 | 28 | Workspace::Workspace(desktop_shell_workspace *ws, QObject *p) 29 | : QObject(p) 30 | , m_workspace(ws) 31 | { 32 | desktop_shell_workspace_add_listener(ws, &m_workspace_listener, this); 33 | } 34 | 35 | Workspace::~Workspace() 36 | { 37 | desktop_shell_workspace_remove(m_workspace); 38 | desktop_shell_workspace_destroy(m_workspace); 39 | } 40 | 41 | bool Workspace::isActiveForScreen(UiScreen *screen) const 42 | { 43 | wl_output *out = Client::client()->nativeOutput(screen->screen()); 44 | return m_active.contains(out); 45 | } 46 | 47 | QPoint Workspace::position() const 48 | { 49 | return m_position; 50 | } 51 | 52 | void Workspace::handleActivated(desktop_shell_workspace *ws, wl_output *out) 53 | { 54 | m_active.insert(out); 55 | emit activeChanged(); 56 | } 57 | 58 | void Workspace::handleDeactivated(desktop_shell_workspace *ws, wl_output *out) 59 | { 60 | m_active.remove(out); 61 | emit activeChanged(); 62 | } 63 | 64 | void Workspace::handlePosition(desktop_shell_workspace *ws, int x, int y) 65 | { 66 | m_position = QPoint(x, y); 67 | emit positionChanged(); 68 | } 69 | 70 | const desktop_shell_workspace_listener Workspace::m_workspace_listener = { 71 | wrapInterface(&Workspace::handleActivated), 72 | wrapInterface(&Workspace::handleDeactivated), 73 | wrapInterface(&Workspace::handlePosition) 74 | }; 75 | -------------------------------------------------------------------------------- /src/client/workspace.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef WORKSPACE_H 21 | #define WORKSPACE_H 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | struct wl_output; 28 | struct desktop_shell_workspace; 29 | struct desktop_shell_workspace_listener; 30 | 31 | class UiScreen; 32 | 33 | class Workspace : public QObject 34 | { 35 | Q_OBJECT 36 | Q_PROPERTY(QPoint position READ position NOTIFY positionChanged) 37 | public: 38 | Workspace(desktop_shell_workspace *ws, QObject *p = nullptr); 39 | ~Workspace(); 40 | 41 | QPoint position() const; 42 | 43 | Q_INVOKABLE bool isActiveForScreen(UiScreen *screen) const; 44 | 45 | signals: 46 | void activeChanged(); 47 | void positionChanged(); 48 | 49 | private: 50 | void handleActivated(desktop_shell_workspace *ws, wl_output *output); 51 | void handleDeactivated(desktop_shell_workspace *ws, wl_output *output); 52 | void handlePosition(desktop_shell_workspace *wd, int x, int y); 53 | 54 | desktop_shell_workspace *m_workspace; 55 | QSet m_active; 56 | QPoint m_position; 57 | 58 | static const desktop_shell_workspace_listener m_workspace_listener; 59 | 60 | friend class Client; 61 | }; 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /src/compositor/animationcurve.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giucam/orbital/512c1b3b20a32cf67ba326e8acce3c1c32e11fa2/src/compositor/animationcurve.h -------------------------------------------------------------------------------- /src/compositor/authorizer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef ORBITAL_AUTHORIZER_H 21 | #define ORBITAL_AUTHORIZER_H 22 | 23 | #include 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include "interface.h" 31 | #include "stringview.h" 32 | 33 | struct wl_resource; 34 | 35 | namespace Orbital { 36 | 37 | class Compositor; 38 | class TrustedClient; 39 | class Helper; 40 | 41 | class Authorizer : public QObject, public Global 42 | { 43 | public: 44 | explicit Authorizer(Compositor *compositor); 45 | ~Authorizer(); 46 | 47 | void addRestrictedInterface(StringView interface); 48 | void removeRestrictedInterface(StringView interface); 49 | 50 | bool isClientTrusted(StringView interface, wl_client *c) const; 51 | 52 | protected: 53 | void bind(wl_client *client, uint32_t version, uint32_t id) override; 54 | 55 | private: 56 | void destroy(wl_client *client, wl_resource *res); 57 | void authorize(wl_client *client, wl_resource *res, uint32_t id, const char *global); 58 | void grant(wl_resource *res); 59 | void deny(wl_resource *res); 60 | void addTrustedClient(StringView interface, wl_client *c); 61 | 62 | std::vector m_restrictedIfaces; 63 | std::unordered_map> m_trustedClients; 64 | Helper *m_helper; 65 | }; 66 | 67 | } 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /src/compositor/backend.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2014 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef ORBITAL_BACKEND_H 21 | #define ORBITAL_BACKEND_H 22 | 23 | #include 24 | 25 | #include 26 | 27 | #include "stringview.h" 28 | 29 | class QPluginLoader; 30 | 31 | struct weston_compositor; 32 | 33 | namespace Orbital { 34 | 35 | class Backend : public QObject 36 | { 37 | Q_OBJECT 38 | public: 39 | Backend(); 40 | 41 | virtual bool init(weston_compositor *c) = 0; 42 | }; 43 | 44 | class BackendFactory 45 | { 46 | public: 47 | static void searchPlugins(); 48 | static void cleanupPlugins(); 49 | 50 | static Backend *createBackend(StringView name); 51 | 52 | private: 53 | std::unordered_map m_factories; 54 | }; 55 | 56 | } 57 | 58 | Q_DECLARE_INTERFACE(Orbital::Backend, "Orbital.Compositor.Backend") 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /src/compositor/binding.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2014 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef ORBITAL_BINDING_H 21 | #define ORBITAL_BINDING_H 22 | 23 | #include 24 | 25 | #include 26 | 27 | struct weston_binding; 28 | struct weston_compositor; 29 | 30 | namespace Orbital { 31 | 32 | class Seat; 33 | enum class PointerButton : unsigned char; 34 | enum class PointerAxis : unsigned char; 35 | enum class KeyboardModifiers : unsigned char; 36 | enum class PointerHotSpot : unsigned char; 37 | 38 | class Binding : public QObject 39 | { 40 | Q_OBJECT 41 | public: 42 | explicit Binding(QObject *p = nullptr); 43 | virtual ~Binding(); 44 | 45 | protected: 46 | weston_binding *m_binding; 47 | }; 48 | 49 | class ButtonBinding : public Binding 50 | { 51 | Q_OBJECT 52 | public: 53 | ButtonBinding(weston_compositor *c, PointerButton b, KeyboardModifiers modifiers, QObject *p = nullptr); 54 | 55 | signals: 56 | void triggered(Seat *seat, uint32_t time, PointerButton button); 57 | }; 58 | 59 | class KeyBinding : public Binding 60 | { 61 | Q_OBJECT 62 | public: 63 | KeyBinding(weston_compositor *c, uint32_t key, KeyboardModifiers modifiers, QObject *p = nullptr); 64 | 65 | signals: 66 | void triggered(Seat *seat, uint32_t time, uint32_t key); 67 | }; 68 | 69 | class AxisBinding : public Binding 70 | { 71 | Q_OBJECT 72 | public: 73 | AxisBinding(weston_compositor *c, PointerAxis axis, KeyboardModifiers modifiers, QObject *p = nullptr); 74 | 75 | signals: 76 | void triggered(Seat *seat, uint32_t time, PointerAxis axis, double value); 77 | }; 78 | 79 | class HotSpotBinding : public Binding 80 | { 81 | Q_OBJECT 82 | public: 83 | HotSpotBinding(PointerHotSpot hs, QObject *p = nullptr); 84 | 85 | signals: 86 | void triggered(Seat *seat, uint32_t time, PointerHotSpot hotspot); 87 | }; 88 | 89 | } 90 | 91 | #endif 92 | -------------------------------------------------------------------------------- /src/compositor/clipboard.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef CLIPBOARD_H 21 | #define CLIPBOARD_H 22 | 23 | #include 24 | 25 | #include 26 | 27 | #include "interface.h" 28 | 29 | namespace Orbital { 30 | 31 | class Shell; 32 | class Seat; 33 | 34 | class ClipboardManager : public Interface, public Global 35 | { 36 | public: 37 | ClipboardManager(Shell *shell); 38 | ~ClipboardManager(); 39 | 40 | private: 41 | void bind(wl_client *client, uint32_t version, uint32_t id) override; 42 | void destroy(wl_client *client, wl_resource *resource); 43 | void selection(Seat *seat); 44 | 45 | std::vector m_resources; 46 | }; 47 | 48 | } 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /src/compositor/dashboard.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Giulio Camuffo 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | */ 17 | 18 | #ifndef ORBITAL_DASHBOARD_H 19 | #define ORBITAL_DASHBOARD_H 20 | 21 | #include 22 | 23 | #include 24 | 25 | #include "workspace.h" 26 | 27 | namespace Orbital { 28 | 29 | class Shell; 30 | class Seat; 31 | class ButtonBinding; 32 | class HotSpotBinding; 33 | 34 | class Dashboard : public QObject, public AbstractWorkspace 35 | { 36 | public: 37 | class View; 38 | 39 | Dashboard(Shell *shell); 40 | 41 | AbstractWorkspace::View *viewForOutput(Output *o) override; 42 | void activate(Output *o) override; 43 | 44 | private: 45 | void toggleSurface(Seat *seat); 46 | void toggle(Seat *seat); 47 | 48 | Shell *m_shell; 49 | std::unordered_map m_views; 50 | bool m_visible; 51 | ButtonBinding *m_toggleSurfaceBinding; 52 | HotSpotBinding *m_toggleBinding; 53 | }; 54 | 55 | } 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /src/compositor/debug.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #include "debug.h" 21 | 22 | namespace Orbital { 23 | 24 | bool Debug::s_debugActive = false; 25 | 26 | void Debug::toggleDebugOutput() 27 | { 28 | s_debugActive = !s_debugActive; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/compositor/debug.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef DEBUG_H 21 | #define DEBUG_H 22 | 23 | #include "fmt/format.h" 24 | #include "fmt/ostream.h" 25 | 26 | #include 27 | 28 | namespace Orbital { 29 | 30 | class Debug 31 | { 32 | public: 33 | template 34 | static void debug(Args &&... args) { 35 | if (s_debugActive) { 36 | fmt::print(stderr, std::forward(args)...); 37 | fmt::print(stderr, "\n"); 38 | } 39 | } 40 | 41 | static void toggleDebugOutput(); 42 | 43 | private: 44 | static bool s_debugActive; 45 | }; 46 | 47 | } 48 | 49 | inline std::ostream &operator<<(std::ostream &os, const QRect &rect) { 50 | os << "(" << rect.x() << "," << rect.y() << " " << rect.width() << "x" << rect.height() << ")"; 51 | return os; 52 | } 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /src/compositor/desktop-shell/desktop-shell-launcher.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef ORBITAL_DESKTOP_SHELL_LAUNCHER 21 | #define ORBITAL_DESKTOP_SHELL_LAUNCHER 22 | 23 | #include 24 | 25 | #include "../interface.h" 26 | 27 | struct wl_resource; 28 | 29 | namespace Orbital { 30 | 31 | class Shell; 32 | class KeyBinding; 33 | class Seat; 34 | class LauncherSurface; 35 | 36 | class DesktopShellLauncher : public Interface, public Global 37 | { 38 | Q_OBJECT 39 | public: 40 | DesktopShellLauncher(Shell *shell); 41 | 42 | protected: 43 | void bind(wl_client *client, uint32_t version, uint32_t id) override; 44 | 45 | private: 46 | void getLauncherSurface(wl_client *client, wl_resource *resource, uint32_t id, wl_resource *surfaceResource); 47 | void toggle(Seat *seat); 48 | 49 | Shell *m_shell; 50 | QPointer m_surface; 51 | }; 52 | 53 | } 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /src/compositor/desktop-shell/desktop-shell-notifications.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef ORBITAL_DESKTOP_SHELL_NOTIFICATIONS_H 21 | #define ORBITAL_DESKTOP_SHELL_NOTIFICATIONS_H 22 | 23 | #include 24 | #include 25 | 26 | #include "../interface.h" 27 | 28 | namespace Orbital { 29 | 30 | class Shell; 31 | 32 | class DesktopShellNotifications : public Interface, public Global 33 | { 34 | Q_OBJECT 35 | public: 36 | DesktopShellNotifications(Shell *shell); 37 | ~DesktopShellNotifications(); 38 | 39 | protected: 40 | void bind(wl_client *client, uint32_t version, uint32_t id) override; 41 | 42 | private: 43 | class NotificationSurface; 44 | void pushNotification(wl_client *, wl_resource *res, uint32_t id, wl_resource *surfaceResource, int32_t flags); 45 | void relayout(); 46 | 47 | Shell *m_shell; 48 | std::list m_notifications; 49 | }; 50 | 51 | } 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /src/compositor/desktop-shell/desktop-shell-settings.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #include 21 | #include 22 | 23 | #include 24 | #include 25 | 26 | #include "../utils.h" 27 | #include "../shell.h" 28 | #include "../global.h" 29 | #include "../compositor.h" 30 | #include "../seat.h" 31 | #include "desktop-shell-settings.h" 32 | #include "wayland-desktop-shell-server-protocol.h" 33 | 34 | namespace Orbital { 35 | 36 | DesktopShellSettings::DesktopShellSettings(Shell *shell) 37 | : Interface(shell) 38 | , Global(shell->compositor(), &orbital_settings_interface, 1) 39 | , m_shell(shell) 40 | { 41 | } 42 | 43 | void DesktopShellSettings::bind(wl_client *client, uint32_t version, uint32_t id) 44 | { 45 | wl_resource *resource = wl_resource_create(client, &orbital_settings_interface, version, id); 46 | 47 | // FIXME 48 | // // We trust only client we started ourself 49 | // pid_t pid; 50 | // wl_client_get_credentials(client, &pid, nullptr, nullptr); 51 | // if (pid != getpid()) { 52 | // wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT, "permission to bind orbital_settings denied"); 53 | // wl_resource_destroy(resource); 54 | // return; 55 | // } 56 | 57 | static const struct orbital_settings_interface implementation = { 58 | wrapInterface(destroy), 59 | wrapInterface(setKeymap), 60 | }; 61 | 62 | wl_resource_set_implementation(resource, &implementation, this, nullptr); 63 | } 64 | 65 | void DesktopShellSettings::destroy(wl_client *client, wl_resource *resource) 66 | { 67 | wl_resource_destroy(resource); 68 | } 69 | 70 | void DesktopShellSettings::setKeymap(const char *layout) 71 | { 72 | for (Seat *seat: m_shell->compositor()->seats()) { 73 | seat->setKeymap(Keymap(StringView(layout), Maybe(), Maybe())); 74 | } 75 | } 76 | 77 | } 78 | -------------------------------------------------------------------------------- /src/compositor/desktop-shell/desktop-shell-settings.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef ORBITAL_DESKTOP_SHELL_SETTINGS 21 | #define ORBITAL_DESKTOP_SHELL_SETTINGS 22 | 23 | #include 24 | 25 | #include "../interface.h" 26 | 27 | struct wl_resource; 28 | 29 | namespace Orbital { 30 | 31 | class Shell; 32 | 33 | class DesktopShellSettings : public Interface, public Global 34 | { 35 | Q_OBJECT 36 | public: 37 | DesktopShellSettings(Shell *shell); 38 | 39 | protected: 40 | void bind(wl_client *client, uint32_t version, uint32_t id) override; 41 | 42 | private: 43 | void destroy(wl_client *client, wl_resource *resource); 44 | void setKeymap(const char *layout); 45 | 46 | Shell *m_shell; 47 | }; 48 | 49 | } 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /src/compositor/desktop-shell/desktop-shell-splash.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2014 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef ORBITAL_DESKTOP_SHELL_SPLASH 21 | #define ORBITAL_DESKTOP_SHELL_SPLASH 22 | 23 | #include 24 | 25 | #include "../interface.h" 26 | 27 | struct wl_resource; 28 | 29 | namespace Orbital { 30 | 31 | class Shell; 32 | class ChildProcess; 33 | class Splash; 34 | 35 | class DesktopShellSplash : public Interface, public Global 36 | { 37 | Q_OBJECT 38 | public: 39 | DesktopShellSplash(Shell *shell); 40 | ~DesktopShellSplash(); 41 | 42 | void hide(); 43 | 44 | protected: 45 | void bind(wl_client *client, uint32_t version, uint32_t id) override; 46 | 47 | private: 48 | void setSplashSurface(wl_resource *outputResource, wl_resource *surfaceResource); 49 | 50 | Shell *m_shell; 51 | ChildProcess *m_client; 52 | wl_resource *m_resource; 53 | std::list m_splashes; 54 | 55 | friend Splash; 56 | }; 57 | 58 | } 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /src/compositor/desktop-shell/desktop-shell-window.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2014 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef ORBITAL_DESKTOP_SHELL_WINDOW_H 21 | #define ORBITAL_DESKTOP_SHELL_WINDOW_H 22 | 23 | #include 24 | 25 | #include "../interface.h" 26 | 27 | namespace Orbital { 28 | 29 | class ShellSurface; 30 | class DesktopShell; 31 | class Seat; 32 | 33 | class DesktopShellWindow : public Interface 34 | { 35 | Q_OBJECT 36 | public: 37 | DesktopShellWindow(DesktopShell *ds); 38 | ~DesktopShellWindow(); 39 | 40 | void create(); 41 | 42 | protected: 43 | virtual void added() override; 44 | 45 | private: 46 | ShellSurface *shsurf(); 47 | void surfaceTypeChanged(); 48 | void activated(Seat *seat); 49 | void deactivated(Seat *seat); 50 | void minimized(); 51 | void restored(); 52 | void mapped(); 53 | void destroy(); 54 | void sendState(); 55 | void sendTitle(); 56 | void setState(wl_client *client, wl_resource *resource, wl_resource *output, int32_t state); 57 | void close(wl_client *client, wl_resource *resource); 58 | void preview(wl_resource *output); 59 | void endPreview(wl_resource *output); 60 | 61 | DesktopShell *m_desktopShell; 62 | wl_resource *m_resource; 63 | int32_t m_state; 64 | bool m_sendState; 65 | }; 66 | 67 | } 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /src/compositor/desktop-shell/desktop-shell-workspace.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2014 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef ORBITAL_DESKTOP_SHELL_WORKSPACE_H 21 | #define ORBITAL_DESKTOP_SHELL_WORKSPACE_H 22 | 23 | #include 24 | 25 | #include "../interface.h" 26 | 27 | struct wl_client; 28 | struct wl_resource; 29 | 30 | namespace Orbital { 31 | 32 | class Workspace; 33 | class Output; 34 | class Shell; 35 | 36 | class DesktopShellWorkspace : public Interface 37 | { 38 | Q_OBJECT 39 | public: 40 | DesktopShellWorkspace(Shell *shell, Workspace *ws); 41 | 42 | void init(wl_client *client, uint32_t id); 43 | void sendActivatedState(); 44 | void sendPosition(); 45 | wl_resource *resource() const { return m_resource; } 46 | Workspace *workspace() const { return m_workspace; } 47 | 48 | static DesktopShellWorkspace *fromResource(wl_resource *resource); 49 | 50 | private: 51 | void workspaceActivated(Workspace *ws, Output *o); 52 | void outputRemoved(Output *o); 53 | void removed(wl_client *client, wl_resource *res); 54 | 55 | Shell *m_shell; 56 | Workspace *m_workspace; 57 | wl_resource *m_resource; 58 | std::list m_active; 59 | }; 60 | 61 | } 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /src/compositor/drm-backend/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | find_package(Qt5Core) 3 | 4 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/.. /usr/include/libdrm) 5 | 6 | set(SOURCES drm-backend.cpp) 7 | 8 | add_library(drm-backend SHARED ${SOURCES}) 9 | qt5_use_modules(drm-backend Core) 10 | install(TARGETS drm-backend DESTINATION lib/orbital/compositor/backends) 11 | -------------------------------------------------------------------------------- /src/compositor/drm-backend/drm-backend.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2014 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef ORBITAL_DRM_BACKEND_H 21 | #define ORBITAL_DRM_BACKEND_H 22 | 23 | #include "backend.h" 24 | #include "utils.h" 25 | 26 | namespace Orbital { 27 | 28 | class DrmBackend : public Backend 29 | { 30 | Q_OBJECT 31 | Q_PLUGIN_METADATA(IID "Orbital.Compositor.Backend" FILE "drm-backend.json") 32 | Q_INTERFACES(Orbital::Backend) 33 | public: 34 | DrmBackend(); 35 | 36 | bool init(weston_compositor *c) override; 37 | 38 | private: 39 | Listener m_pendingListener; 40 | }; 41 | 42 | } 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /src/compositor/drm-backend/drm-backend.json: -------------------------------------------------------------------------------- 1 | { 2 | "Keys": [ "drm-backend" ] 3 | } 4 | -------------------------------------------------------------------------------- /src/compositor/dropdown.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2014 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef ORBITAL_SCROLLDOWN_H 21 | #define ORBITAL_SCROLLDOWN_H 22 | 23 | #include 24 | 25 | #include "interface.h" 26 | 27 | namespace Orbital { 28 | 29 | class Shell; 30 | class Layer; 31 | class Surface; 32 | 33 | class Dropdown : public Interface, public Global 34 | { 35 | public: 36 | Dropdown(Shell *shell); 37 | ~Dropdown(); 38 | 39 | private: 40 | class DropdownSurface; 41 | 42 | void bind(wl_client *client, uint32_t version, uint32_t id) override; 43 | void getDropdownSurface(wl_client *client, wl_resource *dropdown, uint32_t id, wl_resource *surface); 44 | 45 | Shell *m_shell; 46 | Layer *m_layer; 47 | DropdownSurface *m_surface; 48 | }; 49 | 50 | } 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /src/compositor/dummysurface.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2014 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #include 21 | 22 | #include "dummysurface.h" 23 | #include "compositor.h" 24 | 25 | namespace Orbital { 26 | 27 | DummySurface::DummySurface(Compositor *c, int w, int h) 28 | : Surface(weston_surface_create(c->m_compositor)) 29 | , m_acceptInput(true) 30 | { 31 | weston_surface *s = surface(); 32 | weston_surface_set_color(s, 0.0, 0.0, 0.0, 1); 33 | setSize(w, h); 34 | setLabel("dummy"); 35 | } 36 | 37 | DummySurface::~DummySurface() 38 | { 39 | } 40 | 41 | void DummySurface::setSize(int w, int h) 42 | { 43 | weston_surface *s = surface(); 44 | 45 | weston_surface_set_size(s, w, h); 46 | pixman_region32_fini(&s->opaque); 47 | pixman_region32_init_rect(&s->opaque, 0, 0, w, h); 48 | weston_surface_damage(s); 49 | 50 | if (m_acceptInput) { 51 | pixman_region32_fini(&s->input); 52 | pixman_region32_init_rect(&s->input, 0, 0, w, h); 53 | } 54 | } 55 | 56 | void DummySurface::setAcceptInput(bool accept) 57 | { 58 | if (m_acceptInput == accept) { 59 | return; 60 | } 61 | 62 | m_acceptInput = accept; 63 | weston_surface *s = surface(); 64 | int w = accept ? width() : 0; 65 | int h = accept ? height() : 0; 66 | pixman_region32_fini(&s->input); 67 | pixman_region32_init_rect(&s->input, 0, 0, w, h); 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /src/compositor/dummysurface.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2014 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef ORBITAL_DUMMYSURFACE_H 21 | #define ORBITAL_DUMMYSURFACE_H 22 | 23 | #include "view.h" 24 | #include "surface.h" 25 | 26 | struct weston_surface; 27 | 28 | namespace Orbital { 29 | 30 | class Compositor; 31 | 32 | class DummySurface : public Surface 33 | { 34 | public: 35 | explicit DummySurface(Compositor *c, int width = 0, int height = 0); 36 | ~DummySurface(); 37 | 38 | void setSize(int width, int height); 39 | void setAcceptInput(bool m_acceptInput); 40 | 41 | private: 42 | DummySurface(weston_surface *s, int width, int height); 43 | 44 | bool m_acceptInput; 45 | 46 | friend Compositor; 47 | }; 48 | 49 | } 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /src/compositor/effect.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2014 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #include "effect.h" 21 | 22 | namespace Orbital { 23 | 24 | Effect::Effect(QObject *p) 25 | : QObject(p) 26 | { 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/compositor/effect.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2014 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef ORBITAL_EFFECT_H 21 | #define ORBITAL_EFFECT_H 22 | 23 | #include 24 | 25 | namespace Orbital { 26 | 27 | class Effect : public QObject 28 | { 29 | Q_OBJECT 30 | public: 31 | explicit Effect(QObject *p = nullptr); 32 | 33 | }; 34 | 35 | } 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /src/compositor/effects/desktopgrid.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2014 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef ORBITAL_DESKTOPGRID_H 21 | #define ORBITAL_DESKTOPGRID_H 22 | 23 | #include "../effect.h" 24 | 25 | namespace Orbital { 26 | 27 | class Shell; 28 | class Seat; 29 | class Pointer; 30 | class AxisBinding; 31 | enum class KeyboardModifiers : unsigned char; 32 | 33 | class DesktopGrid : public Effect 34 | { 35 | public: 36 | explicit DesktopGrid(Shell *shell); 37 | ~DesktopGrid(); 38 | 39 | private: 40 | class Grab; 41 | 42 | void runKey(Seat *seat, uint32_t time, int key); 43 | void runHotSpot(Seat *seat, uint32_t time, PointerHotSpot hs); 44 | void run(Seat *seat); 45 | void terminate(Output *out, Workspace *ws); 46 | void outputCreated(Output *o); 47 | void outputRemoved(Output *o); 48 | void pointerEnter(Pointer *p); 49 | void workspaceActivated(Workspace *ws, Output *out); 50 | 51 | Shell *m_shell; 52 | HotSpotBinding *m_hsBinding; 53 | QSet m_activeOutputs; 54 | }; 55 | 56 | } 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /src/compositor/effects/zoomeffect.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2014 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #include 21 | 22 | #include "zoomeffect.h" 23 | #include "../shell.h" 24 | #include "../compositor.h" 25 | #include "../global.h" 26 | #include "../binding.h" 27 | #include "../seat.h" 28 | #include "../output.h" 29 | 30 | namespace Orbital { 31 | 32 | ZoomEffect::ZoomEffect(Shell *shell) 33 | : Effect(shell) 34 | , m_shell(shell) 35 | { 36 | m_binding = shell->compositor()->createAxisBinding(PointerAxis::Vertical, KeyboardModifiers::Super); 37 | connect(m_binding, &AxisBinding::triggered, this, &ZoomEffect::run); 38 | } 39 | 40 | ZoomEffect::~ZoomEffect() 41 | { 42 | } 43 | 44 | void ZoomEffect::run(Seat *seat, uint32_t time, PointerAxis axis, double value) 45 | { 46 | for (Output *out: m_shell->compositor()->outputs()) { 47 | if (out->contains(seat->pointer()->x(), seat->pointer()->y())) { 48 | weston_output *output = out->output(); 49 | /* For every pixel zoom 20th of a step */ 50 | float increment = output->zoom.increment * -value / 20.f; 51 | 52 | output->zoom.level += increment; 53 | 54 | if (output->zoom.level < 0.f) { 55 | output->zoom.level = 0.f; 56 | } else if (output->zoom.level > output->zoom.max_level) { 57 | output->zoom.level = output->zoom.max_level; 58 | } 59 | 60 | if (!output->zoom.active) { 61 | if (output->zoom.level <= 0.0) { 62 | continue; 63 | } 64 | weston_output_activate_zoom(output, seat->westonSeat()); 65 | } 66 | 67 | output->zoom.spring_z.target = output->zoom.level; 68 | weston_output_update_zoom(output); 69 | } 70 | } 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /src/compositor/effects/zoomeffect.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2014 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef ORBITAL_ZOOMEFFECT_H 21 | #define ORBITAL_ZOOMEFFECT_H 22 | 23 | #include "../effect.h" 24 | 25 | namespace Orbital { 26 | 27 | class Shell; 28 | class Seat; 29 | class AxisBinding; 30 | enum class PointerAxis : unsigned char; 31 | 32 | class ZoomEffect : public Effect 33 | { 34 | public: 35 | ZoomEffect(Shell *shell); 36 | ~ZoomEffect(); 37 | 38 | private: 39 | void run(Seat *seat, uint32_t time, PointerAxis axis, double value); 40 | 41 | Shell *m_shell; 42 | AxisBinding *m_binding; 43 | }; 44 | 45 | } 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /src/compositor/fmt/ostream.cc: -------------------------------------------------------------------------------- 1 | /* 2 | Formatting library for C++ - std::ostream support 3 | 4 | Copyright (c) 2012 - 2016, Victor Zverovich 5 | All rights reserved. 6 | 7 | For the license information refer to format.h. 8 | */ 9 | 10 | #include "ostream.h" 11 | 12 | namespace fmt { 13 | 14 | namespace internal { 15 | FMT_FUNC void write(std::ostream &os, Writer &w) { 16 | const char *data = w.data(); 17 | typedef internal::MakeUnsigned::Type UnsignedStreamSize; 18 | UnsignedStreamSize size = w.size(); 19 | UnsignedStreamSize max_size = 20 | internal::to_unsigned((std::numeric_limits::max)()); 21 | do { 22 | UnsignedStreamSize n = size <= max_size ? size : max_size; 23 | os.write(data, static_cast(n)); 24 | data += n; 25 | size -= n; 26 | } while (size != 0); 27 | } 28 | } 29 | 30 | FMT_FUNC void print(std::ostream &os, CStringRef format_str, ArgList args) { 31 | MemoryWriter w; 32 | w.write(format_str, args); 33 | internal::write(os, w); 34 | } 35 | } // namespace fmt 36 | -------------------------------------------------------------------------------- /src/compositor/focusscope.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | 21 | #ifndef ORBITAL_FOCUSSCOPE_H 22 | #define ORBITAL_FOCUSSCOPE_H 23 | 24 | #include 25 | 26 | #include 27 | 28 | namespace Orbital { 29 | 30 | class Shell; 31 | class Workspace; 32 | class Surface; 33 | class Seat; 34 | 35 | class FocusScope : public QObject 36 | { 37 | public: 38 | FocusScope(Shell *shell); 39 | ~FocusScope(); 40 | 41 | void activate(Workspace *ws); 42 | Surface *activate(Surface *surface); 43 | Surface *activeSurface() const { return m_activeSurface; } 44 | 45 | private: 46 | void deactivateSurface(); 47 | void activated(Seat *seat); 48 | void deactivated(Seat *seat); 49 | 50 | Shell *m_shell; 51 | std::list m_activeSeats; 52 | std::list m_activeSurfaces; 53 | Surface *m_activeSurface; 54 | 55 | friend Seat; 56 | }; 57 | 58 | } 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /src/compositor/gammacontrol.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef ORBITAL_GAMMACONTROL_H 21 | #define ORBITAL_GAMMACONTROL_H 22 | 23 | #include "interface.h" 24 | 25 | struct wl_resource; 26 | 27 | namespace Orbital { 28 | 29 | class Shell; 30 | class Seat; 31 | 32 | class GammaControlManager : public Interface, public RestrictedGlobal 33 | { 34 | public: 35 | GammaControlManager(Shell *shell); 36 | ~GammaControlManager(); 37 | 38 | private: 39 | void bind(wl_client *client, uint32_t version, uint32_t id) override; 40 | void destroy(wl_client *client, wl_resource *resource); 41 | void getGammaControl(wl_client *client, wl_resource *res, uint32_t id, wl_resource *outputRes); 42 | }; 43 | 44 | } 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /src/compositor/global.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2014 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef ORBITAL_GLOBAL_H 21 | #define ORBITAL_GLOBAL_H 22 | 23 | #include "utils.h" 24 | #include "stringview.h" 25 | 26 | namespace Orbital { 27 | 28 | enum class KeyboardModifiers : unsigned char { 29 | None = 0, 30 | Ctrl = (1 << 0), 31 | Alt = (1 << 1), 32 | Super = (1 << 2), 33 | Shift = (1 << 3), 34 | }; 35 | DECLARE_OPERATORS_FOR_FLAGS(KeyboardModifiers) 36 | 37 | enum class PointerButton : unsigned char { 38 | Left = 0, 39 | Right = 1, 40 | Middle = 2, 41 | Side = 3, 42 | Extra = 4, 43 | Forward = 5, 44 | Back = 6, 45 | Task = 7, 46 | Extra2 = 8, 47 | }; 48 | 49 | enum class PointerAxis : unsigned char { 50 | Vertical = 0, 51 | Horizontal = 1 52 | }; 53 | 54 | uint32_t pointerButtonToRaw(PointerButton b); 55 | PointerButton rawToPointerButton(uint32_t b); 56 | 57 | class Keymap 58 | { 59 | public: 60 | Keymap() {} 61 | Keymap(const Maybe &layout, const Maybe &options, const Maybe &variant); 62 | 63 | const Maybe &layout() const { return m_layout; } 64 | const Maybe &options() const { return m_options; } 65 | const Maybe &variant() const { return m_variant; } 66 | 67 | void fill(const Keymap &other); 68 | 69 | private: 70 | Maybe m_layout; 71 | Maybe m_options; 72 | Maybe m_variant; 73 | }; 74 | 75 | 76 | } 77 | 78 | #endif 79 | -------------------------------------------------------------------------------- /src/compositor/layer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2014 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef ORBITAL_LAYER_H 21 | #define ORBITAL_LAYER_H 22 | 23 | #include 24 | #include 25 | 26 | struct weston_layer; 27 | 28 | namespace Orbital { 29 | 30 | class View; 31 | struct Wrapper; 32 | 33 | class Layer 34 | { 35 | public: 36 | explicit Layer(weston_layer *layer); 37 | explicit Layer(Layer *parent = nullptr); 38 | Layer(const Layer &) = delete; 39 | Layer(Layer &&l); 40 | ~Layer(); 41 | 42 | void setParent(Layer *parent); 43 | 44 | void addView(View *view); 45 | void raiseOnTop(View *view); 46 | void lower(View *view); 47 | 48 | View *topView() const; 49 | 50 | void setMask(int x, int y, int w, int h); 51 | void unsetMask(); 52 | void setAcceptInput(bool accept); 53 | bool acceptInput() const { return m_acceptInput; } 54 | 55 | static Layer *fromLayer(weston_layer *layer); 56 | 57 | Layer &operator=(const Layer &) = delete; 58 | Layer &operator=(Layer &&) = delete; 59 | 60 | private: 61 | void addChild(Layer *l); 62 | void removeChild(Layer *l); 63 | 64 | std::unique_ptr m_layer; 65 | Layer *m_parent; 66 | std::vector m_children; 67 | bool m_acceptInput; 68 | }; 69 | 70 | } 71 | 72 | #endif 73 | 74 | -------------------------------------------------------------------------------- /src/compositor/pager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef ORBITAL_PAGER_H 21 | #define ORBITAL_PAGER_H 22 | 23 | #include 24 | #include 25 | 26 | #include 27 | 28 | #include "workspace.h" 29 | 30 | namespace Orbital { 31 | 32 | class Compositor; 33 | class DummySurface; 34 | class Output; 35 | 36 | class Pager : public QObject 37 | { 38 | Q_OBJECT 39 | public: 40 | Pager(Compositor *c); 41 | 42 | void addWorkspace(Workspace *ws); 43 | void activate(Workspace *ws, Output *output); 44 | void activateNextWorkspace(Output *output); 45 | void activatePrevWorkspace(Output *output); 46 | bool isWorkspaceActive(AbstractWorkspace *ws, Output *output) const; 47 | void updateWorkspacesPosition(Output *o); 48 | 49 | signals: 50 | void workspaceActivated(Workspace *ws, Output *o); 51 | 52 | private: 53 | void activate(Workspace::View *wsv, Output *o, bool animate); 54 | void outputCreated(Output *o); 55 | void outputRemoved(Output *o); 56 | void changeWorkspace(Output *o, int d); 57 | 58 | class Root; 59 | 60 | Compositor *m_compositor; 61 | std::unordered_map m_roots; 62 | std::vector m_workspaces; 63 | }; 64 | 65 | } 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /src/compositor/screenshooter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2014 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef SCREENSHOOTER_H 21 | #define SCREENSHOOTER_H 22 | 23 | #include 24 | 25 | #include "interface.h" 26 | 27 | namespace Orbital { 28 | 29 | class Shell; 30 | class Compositor; 31 | 32 | class Screenshooter : public Interface, public RestrictedGlobal 33 | { 34 | public: 35 | Screenshooter(Shell *s); 36 | 37 | private: 38 | void bind(wl_client *client, uint32_t version, uint32_t id) override; 39 | void shoot(wl_client *client, wl_resource *resource, uint32_t id, wl_resource *outputResource, wl_resource *bufferResource); 40 | void shootSurface(wl_client *client, wl_resource *resource, uint32_t id); 41 | 42 | Compositor *m_compositor; 43 | }; 44 | 45 | } 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /src/compositor/shellview.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2014 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef ORBITAL_SHELLVIEW_H 21 | #define ORBITAL_SHELLVIEW_H 22 | 23 | #include 24 | 25 | #include 26 | 27 | #include "view.h" 28 | #include "animation.h" 29 | 30 | namespace Orbital { 31 | 32 | class ShellSurface; 33 | class Output; 34 | class Layer; 35 | class BlackSurface; 36 | class WorkspaceView; 37 | 38 | class ShellView : public View 39 | { 40 | public: 41 | explicit ShellView(ShellSurface *shsurf); 42 | ~ShellView(); 43 | 44 | ShellSurface *surface() const; 45 | 46 | void setDesignedOutput(Output *o); 47 | void move(const QPointF &p); 48 | void setInitialPos(const QPointF &p); 49 | void configureToplevel(bool map, bool maximized, bool fullscreen, int dx, int dy); 50 | void configurePopup(View *parent, int x, int y); 51 | void configureTransient(View *parent, int x, int y); 52 | void configureXWayland(int x, int y); 53 | 54 | void animateAlphaTo(double alpha, const std::function &done = nullptr); 55 | 56 | void cleanupAndUnmap(); 57 | 58 | private: 59 | void mapFullscreen(); 60 | 61 | ShellSurface *m_surface; 62 | Output *m_designedOutput; 63 | QPointF m_initialPos; 64 | bool m_initialPosSet; 65 | QPointF m_savedPos; 66 | bool m_posSaved; 67 | BlackSurface *m_blackSurface; 68 | Animation m_alphaAnimation; 69 | std::function m_animDone; 70 | }; 71 | 72 | } 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /src/compositor/timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef ORBITAL_TIMER_H 21 | #define ORBITAL_TIMER_H 22 | 23 | #include 24 | 25 | struct wl_event_source; 26 | 27 | namespace Orbital { 28 | 29 | class Timer 30 | { 31 | public: 32 | Timer(); 33 | ~Timer(); 34 | 35 | void setRepeat(bool repeat); 36 | void setTimeoutHandler(const std::function &func); 37 | void start(int msecs, const std::function &func); 38 | void start(int msecs); 39 | void stop(); 40 | 41 | static void singleShot(int msecs, const std::function &func); 42 | 43 | private: 44 | void timeout(); 45 | void rearm(); 46 | 47 | std::function m_func; 48 | wl_event_source *m_timerSource; 49 | wl_event_source *m_idleSource; 50 | int m_interval; 51 | bool m_repeat; 52 | }; 53 | 54 | } 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /src/compositor/transform.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2014 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #include 21 | 22 | #include "transform.h" 23 | 24 | namespace Orbital { 25 | 26 | Transform::Transform() 27 | : m_view(nullptr) 28 | { 29 | wl_list_init(&m_transform.link); 30 | reset(); 31 | } 32 | 33 | Transform::Transform(const Transform &t) 34 | : Transform() 35 | { 36 | *this = t; 37 | } 38 | 39 | void Transform::reset() 40 | { 41 | weston_matrix_init(&m_transform.matrix); 42 | } 43 | 44 | void Transform::scale(double x, double y) 45 | { 46 | weston_matrix_scale(&m_transform.matrix, x, y, 1); 47 | } 48 | 49 | void Transform::translate(double x, double y) 50 | { 51 | weston_matrix_translate(&m_transform.matrix, x, y, 0); 52 | } 53 | 54 | Transform Transform::interpolate(const Transform &t1, const Transform &t2, double v) 55 | { 56 | Transform t; 57 | 58 | for (int i = 0; i < 16; ++i) { 59 | t.m_transform.matrix.d[i] = t1.m_transform.matrix.d[i] * (1. - v) + t2.m_transform.matrix.d[i] * v; 60 | } 61 | t.m_transform.matrix.type = t1.m_transform.matrix.type | t2.m_transform.matrix.type; 62 | 63 | return t; 64 | } 65 | 66 | Transform &Transform::operator=(const Transform &t) 67 | { 68 | wl_list_remove(&m_transform.link); 69 | wl_list_init(&m_transform.link); 70 | m_transform = t.m_transform; 71 | wl_list_init(&m_transform.link); 72 | 73 | if (m_view) { 74 | wl_list_insert(&m_view->geometry.transformation_list, &m_transform.link); 75 | } 76 | 77 | return *this; 78 | } 79 | 80 | void Transform::setView(weston_view *v) 81 | { 82 | wl_list_remove(&m_transform.link); 83 | wl_list_init(&m_transform.link); 84 | m_view = v; 85 | 86 | if (m_view) { 87 | wl_list_insert(&m_view->geometry.transformation_list, &m_transform.link); 88 | } 89 | } 90 | 91 | } 92 | -------------------------------------------------------------------------------- /src/compositor/transform.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2014 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef ORBITAL_TRANSFORM_H 21 | #define ORBITAL_TRANSFORM_H 22 | 23 | #include 24 | 25 | #include 26 | 27 | namespace Orbital { 28 | 29 | class View; 30 | 31 | class Transform { 32 | public: 33 | Transform(); 34 | Transform(const Transform &t); 35 | 36 | void reset(); 37 | void scale(double x, double y); 38 | void translate(double x, double y); 39 | 40 | static Transform interpolate(const Transform &t1, const Transform &t2, double v); 41 | 42 | Transform &operator=(const Transform &t); 43 | 44 | private: 45 | void setView(weston_view *v); 46 | 47 | weston_transform m_transform; 48 | weston_view *m_view; 49 | 50 | friend View; 51 | friend QDebug operator<<(QDebug dbg, const Transform &t); 52 | }; 53 | 54 | inline QDebug operator<<(QDebug dbg, const Transform &t) 55 | { 56 | dbg.nospace() << "Transform("; 57 | for (int i = 0; i < 16; ++i) { 58 | dbg.space() << t.m_transform.matrix.d[i]; 59 | } 60 | dbg.nospace() << ")"; 61 | 62 | return dbg.space(); 63 | } 64 | 65 | } 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /src/compositor/wayland-backend/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | find_package(Qt5Core) 3 | 4 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..) 5 | 6 | set(SOURCES wayland-backend.cpp) 7 | 8 | add_library(wayland-backend SHARED ${SOURCES}) 9 | qt5_use_modules(wayland-backend Core) 10 | install(TARGETS wayland-backend DESTINATION lib/orbital/compositor/backends) 11 | -------------------------------------------------------------------------------- /src/compositor/wayland-backend/wayland-backend.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2014 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #include 21 | #include 22 | 23 | #include "wayland-backend.h" 24 | 25 | namespace Orbital { 26 | 27 | WaylandBackend::WaylandBackend() 28 | { 29 | 30 | } 31 | 32 | bool WaylandBackend::init(weston_compositor *c) 33 | { 34 | weston_wayland_backend_config config; 35 | config.base.struct_version = WESTON_WAYLAND_BACKEND_CONFIG_VERSION; 36 | config.base.struct_size = sizeof(config); 37 | config.use_pixman = false; 38 | config.sprawl = false; 39 | config.display_name = nullptr; 40 | config.fullscreen = false; 41 | config.cursor_theme = nullptr; 42 | config.cursor_size = 32; 43 | 44 | if (weston_compositor_load_backend(c, WESTON_BACKEND_WAYLAND, &config.base) != 0) { 45 | return false; 46 | } 47 | 48 | const struct weston_windowed_output_api *api = weston_windowed_output_get_api(c); 49 | if (!api) { 50 | qWarning("Cannot use weston_windowed_output_api."); 51 | return false; 52 | } 53 | 54 | m_pendingListener.setNotify([api](Listener *, void *data) { 55 | auto output = static_cast(data); 56 | 57 | weston_output_set_scale(output, 1); 58 | weston_output_set_transform(output, WL_OUTPUT_TRANSFORM_NORMAL); 59 | api->output_set_size(output, 800, 400); 60 | weston_output_enable(output); 61 | }); 62 | m_pendingListener.connect(&c->output_pending_signal); 63 | 64 | api->output_create(c, "WL1"); 65 | return true; 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /src/compositor/wayland-backend/wayland-backend.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2014 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef ORBITAL_WAYLAND_BACKEND_H 21 | #define ORBITAL_WAYLAND_BACKEND_H 22 | 23 | #include "backend.h" 24 | #include "utils.h" 25 | 26 | namespace Orbital { 27 | 28 | class WaylandBackend : public Backend 29 | { 30 | Q_OBJECT 31 | Q_PLUGIN_METADATA(IID "Orbital.Compositor.Backend" FILE "wayland-backend.json") 32 | Q_INTERFACES(Orbital::Backend) 33 | public: 34 | WaylandBackend(); 35 | 36 | bool init(weston_compositor *c) override; 37 | 38 | private: 39 | Listener m_pendingListener; 40 | }; 41 | 42 | } 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /src/compositor/wayland-backend/wayland-backend.json: -------------------------------------------------------------------------------- 1 | { 2 | "Keys": [ "wayland-backend" ] 3 | } 4 | -------------------------------------------------------------------------------- /src/compositor/weston-desktop/wdesktop.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef ORBITAL_WDESKTOP_H 21 | #define ORBITAL_WDESKTOP_H 22 | 23 | #include 24 | 25 | #include "../interface.h" 26 | 27 | namespace Orbital { 28 | 29 | class Shell; 30 | class Pointer; 31 | 32 | class WDesktop : public Interface 33 | { 34 | public: 35 | explicit WDesktop(Shell *shell, Compositor *c); 36 | ~WDesktop(); 37 | 38 | private: 39 | void pingTimeout(weston_desktop_client *client); 40 | void pong(weston_desktop_client *client); 41 | void surfaceAdded(weston_desktop_surface *surface); 42 | void surfaceRemoved(weston_desktop_surface *surface); 43 | void committed(weston_desktop_surface *surface, int32_t sx, int32_t sy); 44 | void showWindowMenu(weston_desktop_surface *surface, weston_seat *seat, int32_t x, int32_t y); 45 | void setParent(weston_desktop_surface *surface, weston_desktop_surface *parent); 46 | void move(weston_desktop_surface *surface, weston_seat *seat, uint32_t serial); 47 | void resize(weston_desktop_surface *surface, weston_seat *seat, uint32_t serial, weston_desktop_surface_edge edges); 48 | void fullscreenRequested(weston_desktop_surface *surface, bool fullscreen, weston_output *output); 49 | void maximizedRequested(weston_desktop_surface *surface, bool maximized); 50 | void minimizedRequested(weston_desktop_surface *surface); 51 | void setXWaylandPosition(weston_desktop_surface *surface, int32_t x, int32_t y); 52 | 53 | void pointerFocus(Pointer *pointer); 54 | 55 | Compositor *m_compositor; 56 | weston_desktop *m_wdesktop; 57 | Shell *m_shell; 58 | }; 59 | 60 | } 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /src/compositor/x11-backend/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | find_package(Qt5Core) 3 | 4 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..) 5 | 6 | set(SOURCES x11-backend.cpp) 7 | 8 | add_library(x11-backend SHARED ${SOURCES}) 9 | qt5_use_modules(x11-backend Core) 10 | install(TARGETS x11-backend DESTINATION lib/orbital/compositor/backends) 11 | -------------------------------------------------------------------------------- /src/compositor/x11-backend/backend.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "backend.h" 3 | -------------------------------------------------------------------------------- /src/compositor/x11-backend/x11-backend.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2014 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #include 21 | #include 22 | 23 | #include "x11-backend.h" 24 | 25 | namespace Orbital { 26 | 27 | X11Backend::X11Backend() 28 | { 29 | 30 | } 31 | 32 | bool X11Backend::init(weston_compositor *c) 33 | { 34 | weston_x11_backend_config config; 35 | config.base.struct_version = WESTON_X11_BACKEND_CONFIG_VERSION; 36 | config.base.struct_size = sizeof(config); 37 | config.use_pixman = false; 38 | config.fullscreen = false; 39 | config.no_input = false; 40 | 41 | if (weston_compositor_load_backend(c, WESTON_BACKEND_X11, &config.base) != 0) { 42 | return false; 43 | } 44 | 45 | const struct weston_windowed_output_api *api = weston_windowed_output_get_api(c); 46 | if (!api) { 47 | qWarning("Cannot use weston_windowed_output_api."); 48 | return false; 49 | } 50 | 51 | m_pendingListener.setNotify([api](Listener *, void *data) { 52 | auto output = static_cast(data); 53 | 54 | weston_output_set_scale(output, 1); 55 | weston_output_set_transform(output, WL_OUTPUT_TRANSFORM_NORMAL); 56 | api->output_set_size(output, 800, 400); 57 | weston_output_enable(output); 58 | }); 59 | m_pendingListener.connect(&c->output_pending_signal); 60 | 61 | api->output_create(c, "X1"); 62 | 63 | return true; 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /src/compositor/x11-backend/x11-backend.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2014 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef ORBITAL_X11_BACKEND_H 21 | #define ORBITAL_X11_BACKEND_H 22 | 23 | #include "backend.h" 24 | #include "utils.h" 25 | 26 | namespace Orbital { 27 | 28 | class X11Backend : public Backend 29 | { 30 | Q_OBJECT 31 | Q_PLUGIN_METADATA(IID "Orbital.Compositor.Backend" FILE "x11-backend.json") 32 | Q_INTERFACES(Orbital::Backend) 33 | public: 34 | X11Backend(); 35 | 36 | bool init(weston_compositor *c) override; 37 | 38 | private: 39 | Listener m_pendingListener; 40 | }; 41 | 42 | } 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /src/compositor/x11-backend/x11-backend.json: -------------------------------------------------------------------------------- 1 | { 2 | "Keys": [ "x11-backend" ] 3 | } 4 | -------------------------------------------------------------------------------- /src/compositor/xwayland.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2014 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef ORBITAL_XWAYLAND_H 21 | #define ORBITAL_XWAYLAND_H 22 | 23 | #include 24 | 25 | #include "interface.h" 26 | 27 | struct wl_event_source; 28 | struct weston_xserver; 29 | 30 | namespace Orbital { 31 | 32 | class Shell; 33 | 34 | class XWayland : public Interface 35 | { 36 | public: 37 | XWayland(Shell *shell); 38 | ~XWayland(); 39 | 40 | private: 41 | static pid_t spawnXserver(void *ud, const char *xdpy, int abstractFd, int unixFd); 42 | class Process; 43 | 44 | Shell *m_shell; 45 | const weston_xwayland_api *m_api; 46 | weston_xwayland *m_xwayland; 47 | Process *m_process; 48 | wl_client *m_client; 49 | int m_wmFd; 50 | wl_event_source *m_sigusr1Source; 51 | }; 52 | 53 | } 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /src/launcher/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | pkg_check_modules(WaylandClient wayland-client REQUIRED) 2 | 3 | find_package(Qt5 REQUIRED COMPONENTS Core Gui Qml Quick LinguistTools) 4 | 5 | set(CMAKE_AUTOMOC ON) 6 | set(CMAKE_INCLUDE_CURRENT_DIR ON) 7 | 8 | #include_directories(${WaylandClient_INCLUDE_DIRS}) 9 | 10 | set(SOURCES main.cpp matchermodel.cpp) 11 | 12 | wayland_add_protocol_client(SOURCES ../../protocol/desktop-shell.xml desktop-shell) 13 | 14 | qt5_add_resources(RESOURCES resources.qrc) 15 | 16 | add_executable(orbital-launcher ${SOURCES} ${RESOURCES} ${QM_FILES}) 17 | qt5_use_modules(orbital-launcher Qml Quick) 18 | target_link_libraries(orbital-launcher wayland-client) 19 | set_target_properties(orbital-launcher PROPERTIES COMPILE_DEFINITIONS "DATA_PATH=\"${CMAKE_INSTALL_PREFIX}/share/orbital/launcher\"") 20 | target_include_directories(orbital-launcher PUBLIC ${Qt5Gui_PRIVATE_INCLUDE_DIRS}) 21 | 22 | install(TARGETS orbital-launcher DESTINATION bin) 23 | -------------------------------------------------------------------------------- /src/launcher/matchermodel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef ORBITAL_LAUNCHER_MATCHER_MODEL_H 21 | #define ORBITAL_LAUNCHER_MATCHER_MODEL_H 22 | 23 | #include 24 | #include 25 | 26 | 27 | class QFileSystemWatcher; 28 | 29 | class MatcherModel : public QAbstractListModel 30 | { 31 | Q_OBJECT 32 | Q_PROPERTY(QString expression READ expression WRITE setExpression) 33 | public: 34 | MatcherModel(); 35 | 36 | void setCommandPrefix(const QString &prefix); 37 | void addCommand(const QString &command); 38 | 39 | QString expression() const; 40 | void setExpression(const QString &expr); 41 | 42 | int rowCount(const QModelIndex &parent = QModelIndex()) const override; 43 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; 44 | 45 | void addInHistory(const QString &command); 46 | 47 | private: 48 | void buildItemsList(); 49 | void matchExpression(); 50 | 51 | QString m_expression; 52 | QStringList m_items; 53 | QStringList m_matches; 54 | QString m_commandPrefix; 55 | QStringList m_commands; 56 | QFileSystemWatcher *m_watcher; 57 | }; 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /src/launcher/resources.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | launcher.qml 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/screenshooter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | pkg_check_modules(WaylandClient wayland-client REQUIRED) 2 | 3 | find_package(Qt5 REQUIRED COMPONENTS Core Gui Widgets Qml Quick) 4 | 5 | set(CMAKE_AUTOMOC ON) 6 | set(CMAKE_INCLUDE_CURRENT_DIR ON) 7 | 8 | set(SOURCES main.cpp) 9 | 10 | wayland_add_protocol_client(SOURCES ../../protocol/screenshooter.xml screenshooter) 11 | wayland_add_protocol_client(SOURCES ../../protocol/orbital-authorizer.xml authorizer) 12 | 13 | qt5_add_resources(RESOURCES resources.qrc) 14 | 15 | list(APPEND defines "LIBEXEC_PATH=\"${CMAKE_INSTALL_PREFIX}/libexec\"") 16 | list(APPEND defines "QT_MESSAGELOGCONTEXT") 17 | 18 | add_executable(orbital-screenshooter ${SOURCES} ${RESOURCES}) 19 | qt5_use_modules(orbital-screenshooter Widgets Qml Quick) 20 | target_link_libraries(orbital-screenshooter wayland-client) 21 | set_target_properties(orbital-screenshooter PROPERTIES COMPILE_DEFINITIONS "${defines}") 22 | target_include_directories(orbital-screenshooter PUBLIC ${Qt5Gui_PRIVATE_INCLUDE_DIRS}) 23 | 24 | install(TARGETS orbital-screenshooter DESTINATION bin) 25 | 26 | install(FILES imgur DESTINATION libexec) 27 | -------------------------------------------------------------------------------- /src/screenshooter/imgur: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | client_id="134daa45c8e5e61" 4 | file="$1" 5 | 6 | response=$(curl -H "Authorization: Client-ID ${client_id}" -H "Expect: " -F "image=@$file" https://api.imgur.com/3/image.xml 2>/dev/null) 7 | # the "Expect: " header is to get around a problem when using this through 8 | # the Squid proxy. Not sure if it's a Squid bug or what. 9 | if [ $? -ne 0 ]; then 10 | echo "Upload failed" >&2 11 | exit 1 12 | elif [ $(echo $response | grep -c "") -gt 0 ]; then 13 | echo "Error message from imgur:" >&2 14 | echo $response | sed -r 's/.*(.*)<\/error_msg>.*/\1/' >&2 15 | exit 1 16 | fi 17 | 18 | # parse the response and output our stuff 19 | id=$(echo $response | sed -r 's/.*(.*)<\/id>.*/\1/') 20 | deletehash=$(echo $response | sed -r 's/.*(.*)<\/deletehash>.*/\1/') 21 | printf "https://imgur.com/$id.jpg" 22 | printf "Delete page: https://imgur.com/delete/$deletehash" >&2 23 | -------------------------------------------------------------------------------- /src/screenshooter/resources.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | screenshooter.qml 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/splash/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | pkg_check_modules(WaylandClient wayland-client REQUIRED) 2 | 3 | find_package(Qt5 REQUIRED COMPONENTS Core Gui Qml Quick LinguistTools) 4 | 5 | set(CMAKE_AUTOMOC ON) 6 | set(CMAKE_INCLUDE_CURRENT_DIR ON) 7 | 8 | set(SOURCES main.cpp) 9 | 10 | wayland_add_protocol_client(SOURCES 11 | ../../protocol/desktop-shell.xml 12 | desktop-shell 13 | ) 14 | 15 | file(GLOB translations translations/*.ts) 16 | qt5_add_translation(QM_FILES ${translations}) 17 | qt5_add_resources(RESOURCES resources.qrc) 18 | 19 | add_executable(orbital-splash ${SOURCES} ${RESOURCES} ${QM_FILES}) 20 | qt5_use_modules(orbital-splash Qml Quick) 21 | target_link_libraries(orbital-splash wayland-client) 22 | set_target_properties(orbital-splash PROPERTIES COMPILE_DEFINITIONS "DATA_PATH=\"${CMAKE_INSTALL_PREFIX}/share/orbital/splash\"") 23 | target_include_directories(orbital-splash PUBLIC ${Qt5Gui_PRIVATE_INCLUDE_DIRS}) 24 | 25 | install(FILES ${QM_FILES} DESTINATION share/orbital/splash/translations) 26 | install(TARGETS orbital-splash DESTINATION libexec) 27 | -------------------------------------------------------------------------------- /src/splash/resources.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | splash.qml 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/splash/splash.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | import QtQuick 2.1 21 | 22 | Rectangle { 23 | id: root 24 | color: "black" 25 | 26 | Item { 27 | id: orbiter 28 | anchors.centerIn: parent 29 | height: 200 30 | 31 | property real val: 0 32 | 33 | Rectangle { 34 | x: 150 * Math.cos(orbiter.val) - width / 2 35 | y: 100 * Math.sin(orbiter.val) - height / 2 36 | width: 20 37 | height: width 38 | color: "#575757" 39 | radius: width / 2 40 | } 41 | Rectangle { 42 | x: -width / 2 43 | y: -height / 2 44 | width: 50 45 | height: width 46 | color: "#BEBEBE" 47 | radius: width / 2 48 | } 49 | 50 | PropertyAnimation { 51 | target: orbiter 52 | property: "val" 53 | from: 0 54 | to: 2 * Math.PI 55 | loops: Animation.Infinite 56 | running: true 57 | duration: 1500 58 | } 59 | } 60 | 61 | Text { 62 | id: label 63 | text: qsTr("Loading Orbital...") 64 | anchors.horizontalCenter: parent.horizontalCenter 65 | anchors.top: orbiter.bottom 66 | color: "white" 67 | font.pixelSize: 30 68 | font.bold: true 69 | 70 | property real val: 0 71 | opacity: val <= 1 ? val : 2 - val 72 | 73 | PropertyAnimation { 74 | target: label 75 | property: "val" 76 | from: 0 77 | to: 2 78 | loops: Animation.Infinite 79 | running: true 80 | duration: 1200 81 | easing.type: Easing.InOutQuad 82 | } 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /src/splash/translations/it_IT.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | splash 6 | 7 | 8 | Loading Orbital... 9 | Caricamento di Orbital... 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/utils/desktopfile.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef ORBITAL_DESKTOPFILE_H 21 | #define ORBITAL_DESKTOPFILE_H 22 | 23 | #include 24 | #include 25 | 26 | #include "stringview.h" 27 | 28 | namespace Orbital { 29 | 30 | class DesktopFile; 31 | 32 | class DesktopFile 33 | { 34 | public: 35 | DesktopFile(StringView file); 36 | 37 | inline bool isValid() const { return m_valid; } 38 | 39 | void beginGroup(StringView name); 40 | void endGroup(); 41 | 42 | bool hasValue(StringView key) const; 43 | StringView value(StringView key, StringView defaultValue = "") const; 44 | 45 | template 46 | T value(StringView key) const { T t; desktopEntryValue(*this, key, t); return t; } 47 | 48 | private: 49 | bool m_valid; 50 | std::unordered_map m_data; 51 | std::string m_group; 52 | }; 53 | 54 | inline void desktopEntryValue(const DesktopFile &d, StringView key, bool &value) 55 | { 56 | value = d.hasValue(key) && d.value(key) == "true"; 57 | } 58 | 59 | } 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /src/utils/stringview.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Giulio Camuffo 3 | * 4 | * This file is part of Orbital 5 | * 6 | * Orbital is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Orbital is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Orbital. If not, see . 18 | */ 19 | 20 | #ifndef ORBITAL_STRINGVIEW_H 21 | #define ORBITAL_STRINGVIEW_H 22 | 23 | #include 24 | #include 25 | 26 | #include 27 | #include 28 | 29 | namespace Orbital { 30 | 31 | class StringView 32 | { 33 | public: 34 | StringView(); 35 | StringView(const char *str); 36 | StringView(const char *str, size_t l); 37 | StringView(const std::string &str); 38 | StringView(const QByteArray &str); 39 | 40 | inline bool isNull() const { return string == nullptr; } 41 | inline bool isEmpty() const { return !string || size() == 0; } 42 | inline size_t size() const { return end - string; } 43 | bool contains(int c) const; 44 | 45 | std::string toStdString() const; 46 | QString toQString() const; 47 | 48 | void split(int c, const std::function &func) const; 49 | 50 | bool operator==(StringView v) const; 51 | inline bool operator!=(StringView v) const { return !(*this == v); } 52 | 53 | private: 54 | const char *string; 55 | const char *end; 56 | 57 | friend QDebug operator<<(QDebug dbg, StringView v); 58 | friend std::ostream &operator<<(std::ostream &os, StringView v) { 59 | os.write(v.string, v.size()); 60 | return os; 61 | } 62 | }; 63 | 64 | inline bool operator==(const std::string &str, StringView v) { return StringView(str) == v; } 65 | inline bool operator!=(const std::string &str, StringView v) { return StringView(str) != v; } 66 | 67 | inline QDebug operator<<(QDebug dbg, StringView v) 68 | { 69 | QDebugStateSaver saver(dbg); 70 | dbg << QByteArray::fromRawData(v.string, v.size()); 71 | return dbg; 72 | } 73 | 74 | }; 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(compositor) 2 | -------------------------------------------------------------------------------- /test/compositor/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | find_package(Qt5Core) 3 | find_package(Qt5Test) 4 | 5 | set(CMAKE_AUTOMOC ON) 6 | 7 | include_directories(${CMAKE_CURRENT_BINARY_DIR} ../../src/compositor ../../src/utils) 8 | 9 | add_executable(tst_stringview tst_stringview.cpp ../../src/utils/stringview.cpp) 10 | add_test(tst_stringview tst_stringview) 11 | add_dependencies(check tst_stringview) 12 | qt5_use_modules(tst_stringview Core Test) 13 | 14 | add_executable(tst_maybe tst_maybe.cpp) 15 | add_test(tst_maybe tst_maybe) 16 | add_dependencies(check tst_maybe) 17 | qt5_use_modules(tst_maybe Core Test) 18 | -------------------------------------------------------------------------------- /test/compositor/tst_maybe.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | 5 | #include "utils.h" 6 | 7 | using namespace Orbital; 8 | 9 | class TstMaybe : public QObject 10 | { 11 | Q_OBJECT 12 | private slots: 13 | void test(); 14 | }; 15 | 16 | void TstMaybe::test() 17 | { 18 | Maybe m; 19 | QVERIFY(!m); 20 | QVERIFY(!m.isSet()); 21 | 22 | m = 0; 23 | QVERIFY(m); 24 | QVERIFY(m.isSet()); 25 | QCOMPARE(m.value(), 0); 26 | 27 | auto m2 = m; 28 | m.reset(); 29 | QVERIFY(m2); 30 | QCOMPARE(m2.value(), 0); 31 | QVERIFY(!m); 32 | } 33 | 34 | QTEST_MAIN(TstMaybe) 35 | #include "tst_maybe.moc" 36 | --------------------------------------------------------------------------------