Skip to content

Commit

Permalink
cargo update
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxVerevkin committed Aug 29, 2023
1 parent 556a145 commit e642569
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 82 deletions.
74 changes: 34 additions & 40 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Expand Up @@ -15,9 +15,9 @@ libc = "0.2"
indexmap = { version = "2.0", features = ["serde"] }
serde = { version = "1", features = ["derive"] }
serde_yaml = "0.9"
wayrs-client = "0.11"
wayrs-protocols = { version = "0.11", features = ["wlr-layer-shell-unstable-v1"] }
wayrs-utils = { version = "0.9", features = ["shm_alloc", "seats", "keyboard"] }
wayrs-client = "0.12"
wayrs-protocols = { version = "0.12", features = ["wlr-layer-shell-unstable-v1"] }
wayrs-utils = { version = "0.10", features = ["shm_alloc", "seats", "keyboard"] }
smart-default = "0.7.0"
clap = { version = "4.3.0", default-features = false, features = ["std", "derive", "help", "usage"] }

Expand Down
2 changes: 1 addition & 1 deletion src/key.rs
Expand Up @@ -34,7 +34,7 @@ impl FromStr for Key {

let keysym = xkb::keysym_from_name(s, xkb::KEYSYM_NO_FLAGS);

if keysym == xkb::KEY_NoSymbol {
if keysym.raw() == xkb::keysyms::KEY_NoSymbol {
Err(())
} else {
Ok(Self::Keysym {
Expand Down
64 changes: 27 additions & 37 deletions src/main.rs
Expand Up @@ -13,10 +13,10 @@ use std::process::{Command, Stdio};
use clap::Parser;
use pangocairo::cairo;

use wayrs_client::global::*;
use wayrs_client::object::ObjectId;
use wayrs_client::protocol::*;
use wayrs_client::proxy::Proxy;
use wayrs_client::{global::*, EventCtx};
use wayrs_client::{Connection, IoMode};
use wayrs_protocols::wlr_layer_shell_unstable_v1::*;
use wayrs_utils::keyboard::{xkb, Keyboard, KeyboardEvent, KeyboardHandler};
Expand Down Expand Up @@ -284,7 +284,7 @@ impl KeyboardHandler for State {
fn key_presed(&mut self, conn: &mut Connection<Self>, event: KeyboardEvent) {
let keysym = event.xkb_state.key_get_one_sym(event.keycode);

if keysym == xkb::keysyms::KEY_Escape {
if keysym == xkb::Keysym::Escape {
self.exit = true;
conn.break_dispatch_loop();
return;
Expand Down Expand Up @@ -348,63 +348,53 @@ fn wl_registry_cb(conn: &mut Connection<State>, state: &mut State, event: &wl_re
}
}

fn wl_output_cb(
conn: &mut Connection<State>,
state: &mut State,
output: WlOutput,
event: wl_output::Event,
) {
if let wl_output::Event::Scale(scale) = event {
let output = state.outputs.iter_mut().find(|o| o.wl == output).unwrap();
fn wl_output_cb(ctx: EventCtx<State, WlOutput>) {
if let wl_output::Event::Scale(scale) = ctx.event {
let output = ctx
.state
.outputs
.iter_mut()
.find(|o| o.wl == ctx.proxy)
.unwrap();
let scale: u32 = scale.try_into().unwrap();
if output.scale != scale {
output.scale = scale;
state.draw(conn);
ctx.state.draw(ctx.conn);
}
}
}

fn wl_surface_cb(
conn: &mut Connection<State>,
state: &mut State,
surface: WlSurface,
event: wl_surface::Event,
) {
assert_eq!(surface, state.wl_surface);
match event {
fn wl_surface_cb(ctx: EventCtx<State, WlSurface>) {
assert_eq!(ctx.proxy, ctx.state.wl_surface);
match ctx.event {
wl_surface::Event::Enter(output) => {
state.visible_on_outputs.insert(output);
state.draw(conn);
ctx.state.visible_on_outputs.insert(output);
ctx.state.draw(ctx.conn);
}
wl_surface::Event::Leave(output) => {
state.visible_on_outputs.remove(&output);
ctx.state.visible_on_outputs.remove(&output);
}
_ => (),
}
}

fn layer_surface_cb(
conn: &mut Connection<State>,
state: &mut State,
surface: ZwlrLayerSurfaceV1,
event: zwlr_layer_surface_v1::Event,
) {
assert_eq!(surface, state.layer_surface);
match event {
fn layer_surface_cb(ctx: EventCtx<State, ZwlrLayerSurfaceV1>) {
assert_eq!(ctx.proxy, ctx.state.layer_surface);
match ctx.event {
zwlr_layer_surface_v1::Event::Configure(args) => {
if args.width != 0 {
state.width = args.width;
ctx.state.width = args.width;
}
if args.height != 0 {
state.height = args.height;
ctx.state.height = args.height;
}
state.configured = true;
surface.ack_configure(conn, args.serial);
state.draw(conn);
ctx.state.configured = true;
ctx.proxy.ack_configure(ctx.conn, args.serial);
ctx.state.draw(ctx.conn);
}
zwlr_layer_surface_v1::Event::Closed => {
state.exit = true;
conn.break_dispatch_loop();
ctx.state.exit = true;
ctx.conn.break_dispatch_loop();
}
_ => (),
}
Expand Down
2 changes: 1 addition & 1 deletion src/menu.rs
Expand Up @@ -182,7 +182,7 @@ impl Menu {
}

let keysym = xkb.key_get_one_sym(keycode);
if keysym == xkb::keysyms::KEY_BackSpace {
if keysym == xkb::Keysym::BackSpace {
if let Some(parent) = *self.parent.lock().unwrap() {
return Some(Action::Submenu(parent));
}
Expand Down

0 comments on commit e642569

Please sign in to comment.