Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions data/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ install_data(join_paths('icons', 'scalable', 'wayfire.svg'), install_dir: join_p

install_data('wf-locker', install_dir:'/etc/pam.d/')

install_data('xdpw/wayfire', install_dir: '/etc/xdg/xdg-desktop-portal-wlr/')

subdir('css')
3 changes: 3 additions & 0 deletions data/xdpw/wayfire
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[screencast]
chooser_cmd=wf-stream-chooser
chooser_type=simple
24 changes: 12 additions & 12 deletions proto/meson.build
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
wl_protocol_dir = wayland_protos.get_pkgconfig_variable('pkgdatadir')

wl_protocol_dir = wayland_protos.get_variable(pkgconfig: 'pkgdatadir', internal: 'pkgdatadir')
wayland_scanner = find_program('wayland-scanner')

wayland_scanner_code = generator(
Expand All @@ -15,25 +14,26 @@ wayland_scanner_client = generator(
)

client_protocols = [
'wlr-foreign-toplevel-management-unstable-v1.xml',
'wlr-screencopy.xml',
wayfire.get_pkgconfig_variable('pkgdatadir') / 'unstable' / 'wayfire-shell-unstable-v2.xml',
[wl_protocol_dir, 'unstable/xdg-output/xdg-output-unstable-v1.xml'],
[wl_protocol_dir, 'unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml'],
[wl_protocol_dir, 'staging/ext-foreign-toplevel-list/ext-foreign-toplevel-list-v1.xml'],
[wl_protocol_dir, 'staging/ext-image-capture-source/ext-image-capture-source-v1.xml'],
[wl_protocol_dir, 'staging/ext-image-copy-capture/ext-image-copy-capture-v1.xml'],
'wlr-foreign-toplevel-management-unstable-v1.xml',
'wlr-screencopy.xml',
wayfire.get_pkgconfig_variable('pkgdatadir') / 'unstable' / 'wayfire-shell-unstable-v2.xml',
]

if gbm.found() and drm.found() and not get_option('live-previews-dmabuf').disabled()
client_protocols += [join_paths(wl_protocol_dir, 'unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml')]
endif

wl_protos_src = []
wl_protos_client_src = []
wl_protos_headers = []

foreach p : client_protocols
xml = join_paths(p)
wl_protos_client_src += wayland_scanner_code.process(xml)
wl_protos_headers += wayland_scanner_client.process(xml)
wl_protos_src += wayland_scanner_code.process(xml)
endforeach

lib_wl_protos = static_library('wl_protos', wl_protos_src + wl_protos_headers,
lib_wl_protos = static_library('wl_protos', wl_protos_client_src + wl_protos_headers,
dependencies: [wayland_client]) # for the include directory

wf_protos = declare_dependency(
Expand Down
1 change: 1 addition & 0 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ subdir('background')
subdir('dock')
subdir('locker')
subdir('locker-pin')
subdir('stream-chooser')

pkgconfig = import('pkgconfig')
pkgconfig.generate(
Expand Down
29 changes: 29 additions & 0 deletions src/stream-chooser/mainlayout.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include "mainlayout.hpp"
void MainLayout::allocate_vfunc(const Gtk::Widget& widget, int width, int height, int baseline)
{
Gtk::Widget& widget_not_const = const_cast<Gtk::Widget&>(widget);

auto inner = widget_not_const.get_children()[0];
auto alloc = Gtk::Allocation();
alloc.set_height(height / 2);
alloc.set_width(width / 2);
alloc.set_y(height / 4);
alloc.set_x(width / 4);
inner->size_allocate(alloc, -1);
}

void MainLayout::measure_vfunc(const Gtk::Widget& widget, Gtk::Orientation orientation,
int for_size, int& minimum, int& natural, int& minimum_baseline,
int& natural_baseline) const
{
// Answer 1:1 aspect ratio
minimum = std::min(for_size, 300);
natural = std::min(for_size, 2000);
minimum_baseline = -1;
natural_baseline = -1;
}

Gtk::SizeRequestMode MainLayout::get_request_mode_vfunc(const Gtk::Widget& widget) const
{
return Gtk::SizeRequestMode::WIDTH_FOR_HEIGHT;
}
19 changes: 19 additions & 0 deletions src/stream-chooser/mainlayout.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#pragma once

#include <gtkmm.h>
#include <wf-option-wrap.hpp>


class MainLayout : public Gtk::LayoutManager
{
protected:
void allocate_vfunc(const Gtk::Widget& widget, int width, int height, int baseline) override;
void measure_vfunc(const Gtk::Widget& widget, Gtk::Orientation orientation, int for_size, int& minimum,
int& natural, int& minimum_baseline, int& natural_baseline) const override;
Gtk::SizeRequestMode get_request_mode_vfunc(const Gtk::Widget& widget) const override;
std::shared_ptr<Gtk::LayoutManager> layout;

public:
MainLayout()
{}
};
20 changes: 20 additions & 0 deletions src/stream-chooser/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
deps = [
gtkmm,
wf_protos,
wfconfig,
libutil,
gtklayershell,
]

executable(
'wf-stream-chooser',
[
'stream-chooser.cpp',
'toplevelwidget.cpp',
'outputwidget.cpp',
'toplevellayout.cpp',
'mainlayout.cpp',
],
dependencies: deps,
install: true,
)
Loading
Loading