Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mir shell unstable #3052

Closed
wants to merge 45 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
00c0d5f
First cut at mir-shell-unstable-v1.xml
AlanGriffiths Sep 25, 2023
b6fb9fe
Plumb MirShell into configuration
AlanGriffiths Sep 26, 2023
c0e8631
Expose XdgPositionerStable
AlanGriffiths Sep 26, 2023
73c905d
Simplistic implementation (enough to experiment with I hope)
AlanGriffiths Sep 26, 2023
cee43b9
Publish by default
AlanGriffiths Sep 26, 2023
b9d2311
Introduce mir_demo_wayland_extensions library for Wayland extensions
AlanGriffiths Oct 4, 2023
0c01639
Compile as C++
AlanGriffiths Oct 4, 2023
eceaf80
More idiomatic C++
AlanGriffiths Oct 4, 2023
954f4c2
Extract make_shm_pool
AlanGriffiths Oct 5, 2023
45c5083
Don't draw unless needed
AlanGriffiths Oct 6, 2023
3a37d08
Extract generic window class
AlanGriffiths Oct 6, 2023
92cd4b0
Grey window
AlanGriffiths Oct 6, 2023
a1f1a4e
Add stub handlers for pointer events
AlanGriffiths Oct 26, 2023
ff9193c
Add stub handlers for keyboard events
AlanGriffiths Oct 26, 2023
d26eb66
Click to drag
AlanGriffiths Oct 26, 2023
bb88e69
Reorganize code
AlanGriffiths Oct 27, 2023
ef79fa6
First cut at using satellite windows
AlanGriffiths Oct 27, 2023
aa1b9d2
Extract a non-blocking wayland runner
AlanGriffiths Nov 1, 2023
51c7052
Don't sit in a loop if polling fails
AlanGriffiths Nov 1, 2023
7ae3300
Fix gcc builds
AlanGriffiths Nov 24, 2023
4c3ae4b
Introduce normal_window
AlanGriffiths Nov 27, 2023
5b516c5
Consistent naming
AlanGriffiths Nov 27, 2023
fb72bdd
Abort when the server disconnects
AlanGriffiths Nov 28, 2023
08fcb15
The shell should never be nullptr
AlanGriffiths Nov 28, 2023
944bb89
Plumb window archetype into window creation
AlanGriffiths Nov 28, 2023
408f1e1
Only the surface with mouse focus should handle mouse events
AlanGriffiths Nov 28, 2023
c201800
Better starting placement for satellite
AlanGriffiths Dec 4, 2023
276cd07
Some options for satellite placement
AlanGriffiths Dec 4, 2023
6c80ffa
Options to size main window
AlanGriffiths Dec 4, 2023
1f99f56
Ctrl-Q to quit
AlanGriffiths Dec 4, 2023
897a9ac
Tidy up
AlanGriffiths Dec 4, 2023
ac968b6
Refactor wayland runner
AlanGriffiths Dec 6, 2023
548f916
Add a dialog window
AlanGriffiths Dec 6, 2023
0f3697e
"Title" bars and better (re)paint logic
AlanGriffiths Dec 6, 2023
4972884
Runtime options
AlanGriffiths Dec 7, 2023
00fe8d3
Dismissing dialog and moving satellite
AlanGriffiths Dec 7, 2023
88e51bd
Simplify commandline options
AlanGriffiths Dec 7, 2023
cb6cc37
Simplify commandline options
AlanGriffiths Dec 7, 2023
f68bc20
Simplify naming
AlanGriffiths Dec 7, 2023
19054dd
#include <system_error>
AlanGriffiths Dec 7, 2023
6e4f0c9
Give mir-shell its own positioner (copied from xdg-shell)
AlanGriffiths Dec 8, 2023
1aca36a
Update the initial surface spec instead of hacking on creation
AlanGriffiths Dec 8, 2023
db5b93e
Drop loads of stuff that wasn't necessary
AlanGriffiths Dec 8, 2023
8c21424
Factor out more common code
AlanGriffiths Dec 8, 2023
be95ada
Drop unused member
AlanGriffiths Dec 11, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 34 additions & 8 deletions examples/client/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,44 @@
set(OUTPUT_PATH_HEADER "${CMAKE_CURRENT_BINARY_DIR}/xdg-shell.h")
set(OUTPUT_PATH_SRC "${CMAKE_CURRENT_BINARY_DIR}/xdg-shell.c")
set(PROTOCOL_PATH "${PROJECT_SOURCE_DIR}/wayland-protocols/xdg-shell.xml")
set(XDG_SHELL_H "${CMAKE_CURRENT_BINARY_DIR}/xdg-shell.h")
set(XDG_SHELL_C "${CMAKE_CURRENT_BINARY_DIR}/xdg-shell.c")
set(XDG_SHELL_X "${PROJECT_SOURCE_DIR}/wayland-protocols/xdg-shell.xml")

add_custom_command(
OUTPUT "${OUTPUT_PATH_HEADER}" "${OUTPUT_PATH_SRC}"
OUTPUT "${XDG_SHELL_H}" "${XDG_SHELL_C}"
VERBATIM
COMMAND "sh" "-c" "wayland-scanner client-header ${PROTOCOL_PATH} ${OUTPUT_PATH_HEADER}"
COMMAND "sh" "-c" "wayland-scanner private-code ${PROTOCOL_PATH} ${OUTPUT_PATH_SRC}"
COMMAND "sh" "-c" "wayland-scanner client-header ${XDG_SHELL_X} ${XDG_SHELL_H}"
COMMAND "sh" "-c" "wayland-scanner private-code ${XDG_SHELL_X} ${XDG_SHELL_C}"
)

mir_add_wrapped_executable(mir_demo_client_wayland wayland_client.c ${OUTPUT_PATH_HEADER} ${OUTPUT_PATH_SRC})
target_link_libraries (mir_demo_client_wayland PkgConfig::WAYLAND_CLIENT)
set(MIR_SHELL_H "${CMAKE_CURRENT_BINARY_DIR}/mir-shell.h")
set(MIR_SHELL_C "${CMAKE_CURRENT_BINARY_DIR}/mir-shell.c")
set(MIR_SHELL_X "${PROJECT_SOURCE_DIR}/wayland-protocols/mir-shell-unstable-v1.xml")

add_custom_command(
OUTPUT "${MIR_SHELL_H}" "${MIR_SHELL_C}"
VERBATIM
COMMAND "sh" "-c" "wayland-scanner client-header ${MIR_SHELL_X} ${MIR_SHELL_H}"
COMMAND "sh" "-c" "wayland-scanner private-code ${MIR_SHELL_X} ${MIR_SHELL_C}"
)

add_library(mir_demo_wayland_extensions STATIC
${XDG_SHELL_C} ${XDG_SHELL_H}
${MIR_SHELL_C} ${MIR_SHELL_H}
make_shm_pool.c make_shm_pool.h
)
set_target_properties (mir_demo_wayland_extensions PROPERTIES COMPILE_FLAGS "${CMAKE_CFLAGS} -fvisibility=hidden")
target_include_directories(mir_demo_wayland_extensions PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
target_link_libraries (mir_demo_wayland_extensions PUBLIC PkgConfig::WAYLAND_CLIENT)


mir_add_wrapped_executable(mir_demo_client_wayland wayland_client.c)
target_link_libraries (mir_demo_client_wayland mir_demo_wayland_extensions)
target_include_directories(mir_demo_client_wayland PRIVATE ${CMAKE_CURRENT_BINARY_DIR})


mir_add_wrapped_executable(mir_demo_client_wayland_egl_spinner spinner.cpp)
target_link_libraries (mir_demo_client_wayland_egl_spinner miral-spinner)


mir_add_wrapped_executable(mir_demo_client_mir_shell mir_shell_demo.cpp wayland_runner.cpp wayland_runner.h)
target_link_libraries (mir_demo_client_mir_shell mir_demo_wayland_extensions)
target_include_directories(mir_demo_client_mir_shell PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
45 changes: 45 additions & 0 deletions examples/client/make_shm_pool.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright © 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 2 or 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/>.
*/

#include "make_shm_pool.h"

#include <fcntl.h>
#include <unistd.h>
#include <sys/mman.h>

struct wl_shm_pool*
make_shm_pool(struct wl_shm* shm, int size, void **data)
{
int fd = memfd_create("make_shm_pool", MFD_CLOEXEC);

if (fd < 0) {
return NULL;
}

posix_fallocate(fd, 0, size);

*data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (*data == MAP_FAILED) {
close(fd);
return NULL;
}

struct wl_shm_pool *pool = wl_shm_create_pool(shm, fd, size);

close(fd);

return pool;
}
33 changes: 33 additions & 0 deletions examples/client/make_shm_pool.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright © 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 2 or 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/>.
*/

#ifndef MIR_MAKE_SHM_POOL_H
#define MIR_MAKE_SHM_POOL_H

#include <wayland-client.h>

#ifdef __cplusplus
extern "C" {
#endif

struct wl_shm_pool*
make_shm_pool(struct wl_shm* shm, int size, void** data);

#ifdef __cplusplus
}
#endif

#endif //MIR_MAKE_SHM_POOL_H
Loading
Loading