mirror of
https://github.com/WayfireWM/wf-osk.git
synced 2025-04-05 04:46:45 +02:00
update for the new protocol
This commit is contained in:
parent
91584ecc63
commit
fe233eef74
@ -1,6 +1,9 @@
|
||||
<protocol name="wayfire_shell">
|
||||
<interface name="zwf_shell_manager_v1" version="1">
|
||||
<description summary="DE integration">
|
||||
IMPORTANT: most of wayfire-shell is going to be deprecated. Try to
|
||||
use layer-shell instead.
|
||||
|
||||
The purpose of this protocol is to enable the creation of different
|
||||
desktop-interface windows like panels, backgrounds, docks,
|
||||
lockscreens, etc. It also aims to allow the creation of full-blown
|
||||
@ -90,6 +93,7 @@
|
||||
<entry name="bottom" value="2"/>
|
||||
<entry name="panel" value="3"/>
|
||||
<entry name="overlay" value="4"/>
|
||||
<entry name="desktop_widget" value="5"/>
|
||||
</enum>
|
||||
|
||||
<request name="configure">
|
||||
|
@ -90,7 +90,7 @@ std::vector<std::vector<Key>> numeric_keys = {
|
||||
{KEY_0 | USE_SHIFT, ")", 1},
|
||||
{KEY_SEMICOLON, ";", 1},
|
||||
{KEY_SEMICOLON | USE_SHIFT, ":", 1},
|
||||
{KEY_ENTER, "↵", 1}
|
||||
{KEY_ENTER, "↵", 3}
|
||||
},
|
||||
{
|
||||
{KEY_LEFTBRACE, "[", 1},
|
||||
@ -105,7 +105,9 @@ std::vector<std::vector<Key>> numeric_keys = {
|
||||
{KEY_APOSTROPHE, "\'", 1},
|
||||
{KEY_APOSTROPHE | USE_SHIFT, "\"", 1},
|
||||
{KEY_GRAVE, "`", 1},
|
||||
{KEY_GRAVE | USE_SHIFT, "~", 1}
|
||||
{KEY_GRAVE | USE_SHIFT, "~", 1},
|
||||
{KEY_COMMA, ",", 1},
|
||||
{KEY_DOT, ".", 1}
|
||||
},
|
||||
{
|
||||
{ABC_TOGGLE, "abc", 1},
|
||||
|
36
src/main.cpp
36
src/main.cpp
@ -1,4 +1,5 @@
|
||||
#include "osk.hpp"
|
||||
#include <getopt.h>
|
||||
#include <iostream>
|
||||
#include <linux/input-event-codes.h>
|
||||
|
||||
@ -14,6 +15,8 @@ namespace wf
|
||||
namespace osk
|
||||
{
|
||||
int spacing = 8;
|
||||
int default_x = 100;
|
||||
int default_y = 100;
|
||||
int default_width = 800;
|
||||
int default_height = 400;
|
||||
|
||||
@ -119,7 +122,7 @@ namespace wf
|
||||
Keyboard::Keyboard()
|
||||
{
|
||||
window = std::make_unique<WaylandWindow>
|
||||
(default_width, default_height);
|
||||
(default_x, default_y, default_width, default_height);
|
||||
vk = std::make_unique<VirtualKeyboardDevice> ();
|
||||
|
||||
init_layouts();
|
||||
@ -170,8 +173,37 @@ namespace wf
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct option opts[] = {
|
||||
{ "geometry", required_argument, NULL, 'g' },
|
||||
{ 0, 0, NULL, 0 }
|
||||
};
|
||||
|
||||
int c, i;
|
||||
while((c = getopt_long(argc, argv, "g:", opts, &i)) != -1)
|
||||
{
|
||||
using namespace wf::osk;
|
||||
switch(c)
|
||||
{
|
||||
case 'g':
|
||||
if (sscanf(optarg, "%d,%d %dx%d", &default_x, &default_y,
|
||||
&default_width, &default_height) != 4)
|
||||
{
|
||||
std::cerr << "Invalid geometry: " << optarg << std::endl;
|
||||
std::exit(-1);
|
||||
} else
|
||||
{
|
||||
std::cout << "Geometry " << default_x << "," << default_y << " "
|
||||
<< default_width << "x" << default_height;
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
std::cerr << "Unrecognized argument " << char(c) << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
auto app = Gtk::Application::create();
|
||||
wf::osk::Keyboard::create();
|
||||
return app->run(wf::osk::Keyboard::get().get_window());
|
||||
|
@ -74,12 +74,15 @@ namespace wf
|
||||
return instance;
|
||||
}
|
||||
|
||||
WaylandWindow::WaylandWindow(int width, int height)
|
||||
WaylandWindow::WaylandWindow(int x, int y, int width, int height)
|
||||
: Gtk::Window()
|
||||
{
|
||||
auto display = WaylandDisplay::get();
|
||||
|
||||
/* Trick: first show the window, get frame size, then subtract it again */
|
||||
this->set_size_request(width, height);
|
||||
this->set_default_size(width, height);
|
||||
this->set_type_hint(Gdk::WINDOW_TYPE_HINT_DOCK);
|
||||
this->show_all();
|
||||
|
||||
auto gdk_window = this->get_window()->gobj();
|
||||
@ -92,8 +95,9 @@ namespace wf
|
||||
}
|
||||
|
||||
wm_surface = zwf_shell_manager_v1_get_wm_surface(display.wf_manager,
|
||||
surface, ZWF_WM_SURFACE_V1_ROLE_OVERLAY, NULL);
|
||||
surface, ZWF_WM_SURFACE_V1_ROLE_DESKTOP_WIDGET, NULL);
|
||||
zwf_wm_surface_v1_set_keyboard_mode(wm_surface,
|
||||
ZWF_WM_SURFACE_V1_KEYBOARD_FOCUS_MODE_NO_FOCUS);
|
||||
zwf_wm_surface_v1_configure(wm_surface, x, y);
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,6 @@ namespace wf
|
||||
{
|
||||
zwf_wm_surface_v1 *wm_surface;
|
||||
public:
|
||||
WaylandWindow(int width, int height);
|
||||
WaylandWindow(int x, int y, int width, int height);
|
||||
};
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user