Skip to content

Commit

Permalink
Merge #421
Browse files Browse the repository at this point in the history
421: wayland_spinner r=gerboland a=AlanGriffiths

Re-instate the "spinner" when starting miral-shell (re-implementing it in Wayland)

This builds on two PRs that haven't landed yet:

 o Conceal the full type of the "Splash" from the window management policy (#417)
 o Launcher for internal Wayland clients (#416)



Co-authored-by: Alan Griffiths <alan@octopull.co.uk>
  • Loading branch information
bors[bot] and AlanGriffiths committed Jul 4, 2018
2 parents b984948 + 4c9444f commit 8be8853
Show file tree
Hide file tree
Showing 15 changed files with 1,153 additions and 6 deletions.
2 changes: 1 addition & 1 deletion examples/example-server-lib/sw_splash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ void SwSplash::operator()(std::weak_ptr<mir::scene::Session> const& session)

SwSplash::operator std::shared_ptr<SplashSession>() const
{
return std::shared_ptr<SplashSession>{self};
return self;
}

void SwSplash::operator()(MirConnection* connection)
Expand Down
2 changes: 2 additions & 0 deletions examples/miral-shell/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
add_subdirectory(desktop)
add_subdirectory(spinner)

add_custom_target(miral-run ALL
cp ${CMAKE_CURRENT_SOURCE_DIR}/miral-run.sh ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/miral-run
Expand Down Expand Up @@ -46,4 +47,5 @@ mir_add_wrapped_executable(miral-shell

target_link_libraries(miral-shell
example-shell-lib
miral-spinner
)
6 changes: 3 additions & 3 deletions examples/miral-shell/shell_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "tiling_window_manager.h"
#include "floating_window_manager.h"
#include "titlebar_config.h"
#include "sw_splash.h"
#include "spinner/splash.h"

#include <miral/display_configuration_option.h>
#include <miral/runner.h>
Expand All @@ -39,7 +39,7 @@ int main(int argc, char const* argv[])

std::function<void()> shutdown_hook{[]{}};

SwSplash spinner;
SpinnerSplash spinner;
InternalClientLauncher launcher;
WindowManagerOptions window_managers
{
Expand Down Expand Up @@ -89,7 +89,7 @@ int main(int argc, char const* argv[])
config_keymap,
debug_extensions,
AppendEventFilter{quit_on_ctrl_alt_bksp},
StartupInternalClient{"Intro", spinner},
StartupInternalClient{spinner},
pre_init(CommandLineOption{[&](std::string const& typeface) { ::titlebar::font_file(typeface); },
"shell-titlebar-font", "font file to use for titlebars", ::titlebar::font_file()})
});
Expand Down
73 changes: 73 additions & 0 deletions examples/miral-shell/spinner/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# -*- Mode: CMake; indent-tabs-mode: nil; tab-width: 2 -*-
#
# Copyright © 2014 Canonical Ltd.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

pkg_check_modules(WAYLAND_CLIENT REQUIRED wayland-client)
pkg_check_modules(GLIB REQUIRED glib-2.0)
find_package(GLESv2 REQUIRED)
find_package(PIL REQUIRED)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-overlength-strings")


function(png2header png header varname)
add_custom_command(
OUTPUT ${header}
COMMAND python3 ${CMAKE_CURRENT_SOURCE_DIR}/png2header.py ${png} ${varname} > ${header}
DEPENDS ${png} ${CMAKE_CURRENT_SOURCE_DIR}/png2header.py
)
endfunction()

png2header(
${CMAKE_CURRENT_SOURCE_DIR}/spinner-glow.png
${CMAKE_CURRENT_BINARY_DIR}/spinner_glow.h
spinner_glow
)

png2header(
${CMAKE_CURRENT_SOURCE_DIR}/spinner-logo.png
${CMAKE_CURRENT_BINARY_DIR}/spinner_logo.h
spinner_logo
)

include_directories(
${PROJECT_SOURCE_DIR}/include/client
${GLIB_INCLUDE_DIRS}
${GLESv2_INCLUDE_DIRS}
${CMAKE_CURRENT_BINARY_DIR}
)

add_library(miral-spinner STATIC
eglapp.cpp
eglapp.h
eglspinner.cpp
miregl.h
miregl.cpp
splash.h
${CMAKE_CURRENT_BINARY_DIR}/spinner_logo.h
${CMAKE_CURRENT_BINARY_DIR}/spinner_glow.h
)

pkg_check_modules(WAYLAND_EGL REQUIRED wayland-egl)

target_link_libraries(miral-spinner
example-shell-lib
mirclientcpp
EGL
${WAYLAND_EGL_LDFLAGS} ${WAYLAND_EGL_LIBRARIES}
${GLIB_LDFLAGS}
${GLESv2_LIBRARIES}
${MIRCLIENT_LDFLAGS}
)
26 changes: 26 additions & 0 deletions examples/miral-shell/spinner/eglapp.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright © 2013-2018 Canonical Ltd.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU General Public License version 2 or 3 as as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include "eglapp.h"

#include "miregl.h"

std::vector<std::shared_ptr<MirEglSurface>> mir_eglapp_init(struct wl_display* display)
{
auto const mir_egl_app = make_mir_eglapp(display);

return mir_surface_init(mir_egl_app);
}
31 changes: 31 additions & 0 deletions examples/miral-shell/spinner/eglapp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright © 2013 Canonical Ltd.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU General Public License version 2 or 3 as as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Author: Daniel van Vugt <daniel.van.vugt@canonical.com>
*/

#ifndef __EGLAPP_H__
#define __EGLAPP_H__

#include <memory>
#include <vector>

class MirEglSurface;

extern float mir_eglapp_background_opacity;

std::vector<std::shared_ptr<MirEglSurface>> mir_eglapp_init(struct wl_display* display);

#endif
Loading

0 comments on commit 8be8853

Please sign in to comment.