Skip to content

Commit

Permalink
chore: update libcosmic (#168)
Browse files Browse the repository at this point in the history
  • Loading branch information
wash2 authored Dec 11, 2023
1 parent 19ae9b7 commit e5db5ab
Show file tree
Hide file tree
Showing 14 changed files with 141 additions and 193 deletions.
253 changes: 113 additions & 140 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@ lto = "thin"
# [patch."https://github.com/pop-os/libcosmic"]
# libcosmic = { path = "../libcosmic" }
# cosmic-config = { path = "../libcosmic/cosmic-config" }
# [patch."https://github.com/Smithay/client-toolkit"]
[patch."https://github.com/Smithay/client-toolkit"]
sctk = { git = "https://github.com/smithay/client-toolkit//", package = "smithay-client-toolkit", rev = "e63ab5f" }
11 changes: 4 additions & 7 deletions cosmic-app-list/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ struct DndOffer {
struct CosmicAppList {
core: cosmic::app::Core,
popup: Option<(window::Id, DockItem)>,
surface_id_ctr: u128,
subscription_ctr: u32,
item_ctr: u32,
active_list: Vec<DockItem>,
Expand Down Expand Up @@ -424,12 +423,11 @@ impl cosmic::Application for CosmicAppList {
None => return Command::none(),
};

self.surface_id_ctr += 1;
let new_id = window::Id(self.surface_id_ctr);
let new_id = window::Id::unique();
self.popup = Some((new_id, toplevel_group.clone()));

let mut popup_settings = self.core.applet.get_popup_settings(
window::Id(0),
window::Id::MAIN,
new_id,
None,
None,
Expand Down Expand Up @@ -539,8 +537,7 @@ impl cosmic::Application for CosmicAppList {
}
})
{
self.surface_id_ctr += 1;
let icon_id = window::Id(self.surface_id_ctr);
let icon_id = window::Id::unique();
self.dnd_source = Some((icon_id, toplevel_group.clone(), DndAction::empty()));
return start_drag(
vec![MIME_TYPE.to_string()],
Expand All @@ -549,7 +546,7 @@ impl cosmic::Application for CosmicAppList {
} else {
DndAction::Copy
},
window::Id(0),
window::Id::MAIN,
Some(DndIcon::Custom(icon_id)),
Box::new(toplevel_group),
);
Expand Down
6 changes: 2 additions & 4 deletions cosmic-applet-audio/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ struct Audio {
icon_name: String,
input_icon_name: String,
popup: Option<window::Id>,
id_ctr: u128,
timeline: Timeline,
config: AudioAppletConfig,
player_status: Option<mpris_subscription::PlayerStatus>,
Expand Down Expand Up @@ -304,12 +303,11 @@ impl cosmic::Application for Audio {
if let Some(conn) = self.pulse_state.connection() {
conn.send(pulse::Message::UpdateConnection);
}
self.id_ctr += 1;
let new_id = window::Id(self.id_ctr);
let new_id = window::Id::unique();
self.popup.replace(new_id);

let mut popup_settings = self.core.applet.get_popup_settings(
window::Id(0),
window::Id::MAIN,
new_id,
None,
None,
Expand Down
6 changes: 2 additions & 4 deletions cosmic-applet-battery/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ struct CosmicBatteryApplet {
kbd_brightness: f64,
screen_brightness: f64,
popup: Option<window::Id>,
id_ctr: u128,
screen_sender: Option<UnboundedSender<ScreenBacklightRequest>>,
kbd_sender: Option<UnboundedSender<KeyboardBacklightRequest>>,
power_profile: Power,
Expand Down Expand Up @@ -224,12 +223,11 @@ impl cosmic::Application for CosmicBatteryApplet {
let _ = tx.send(ScreenBacklightRequest::Get);
}

self.id_ctr += 1;
let new_id = window::Id(self.id_ctr);
let new_id = window::Id::unique();
self.popup.replace(new_id);

let mut popup_settings = self.core.applet.get_popup_settings(
window::Id(0),
window::Id::MAIN,
new_id,
None,
None,
Expand Down
6 changes: 2 additions & 4 deletions cosmic-applet-bluetooth/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ struct CosmicBluetoothApplet {
core: cosmic::app::Core,
icon_name: String,
popup: Option<window::Id>,
id_ctr: u128,
bluer_state: BluerState,
bluer_sender: Option<Sender<BluerRequest>>,
// UI state
Expand Down Expand Up @@ -117,12 +116,11 @@ impl cosmic::Application for CosmicBluetoothApplet {
return destroy_popup(p);
} else {
// TODO request update of state maybe
self.id_ctr += 1;
let new_id = window::Id(self.id_ctr);
let new_id = window::Id::unique();
self.popup.replace(new_id);

let mut popup_settings = self.core.applet.get_popup_settings(
window::Id(0),
window::Id::MAIN,
new_id,
None,
None,
Expand Down
6 changes: 2 additions & 4 deletions cosmic-applet-graphics/src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ pub struct Window {
core: cosmic::app::Core,
popup: Option<window::Id>,
graphics_mode: Option<GraphicsMode>,
id_ctr: u128,
dbus: Option<(Connection, PowerDaemonProxy<'static>)>,
}

Expand Down Expand Up @@ -113,8 +112,7 @@ impl cosmic::Application for Window {
if let Some(p) = self.popup.take() {
return destroy_popup(p);
} else {
self.id_ctr += 1;
let new_id = window::Id(self.id_ctr);
let new_id = window::Id::unique();
self.popup.replace(new_id);
let mut commands = Vec::new();
if let Some((_, proxy)) = self.dbus.as_ref() {
Expand All @@ -124,7 +122,7 @@ impl cosmic::Application for Window {
));
}
let popup_settings = self.core.applet.get_popup_settings(
window::Id(0),
window::Id::MAIN,
new_id,
None,
None,
Expand Down
6 changes: 2 additions & 4 deletions cosmic-applet-network/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ struct CosmicNetworkApplet {
core: cosmic::app::Core,
icon_name: String,
popup: Option<window::Id>,
id_ctr: u128,
nm_state: NetworkManagerState,
// UI state
nm_sender: Option<UnboundedSender<NetworkManagerRequest>>,
Expand Down Expand Up @@ -226,12 +225,11 @@ impl cosmic::Application for CosmicNetworkApplet {
return destroy_popup(p);
} else {
// TODO request update of state maybe
self.id_ctr += 1;
let new_id = window::Id(self.id_ctr);
let new_id = window::Id::unique();
self.popup.replace(new_id);

let mut popup_settings = self.core.applet.get_popup_settings(
window::Id(0),
window::Id::MAIN,
new_id,
None,
None,
Expand Down
6 changes: 2 additions & 4 deletions cosmic-applet-notifications/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ struct Notifications {
config_helper: Option<Config>,
icon_name: String,
popup: Option<window::Id>,
id_ctr: u128,
// notifications: Vec<Notification>,
timeline: Timeline,
dbus_sender: Option<Sender<subscriptions::dbus::Input>>,
Expand Down Expand Up @@ -187,12 +186,11 @@ impl cosmic::Application for Notifications {
if let Some(p) = self.popup.take() {
return destroy_popup(p);
} else {
self.id_ctr += 1;
let new_id = window::Id(self.id_ctr);
let new_id = window::Id::unique();
self.popup.replace(new_id);

let mut popup_settings = self.core.applet.get_popup_settings(
window::Id(0),
window::Id::MAIN,
new_id,
None,
None,
Expand Down
9 changes: 3 additions & 6 deletions cosmic-applet-power/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ struct Power {
core: cosmic::app::Core,
icon_name: String,
popup: Option<window::Id>,
id_ctr: u128,
action_to_confirm: Option<(window::Id, PowerAction, u8)>,
}

Expand Down Expand Up @@ -128,12 +127,11 @@ impl cosmic::Application for Power {
if let Some(p) = self.popup.take() {
destroy_popup(p)
} else {
self.id_ctr += 1;
let new_id = window::Id(self.id_ctr);
let new_id = window::Id::unique();
self.popup.replace(new_id);

let mut popup_settings = self.core.applet.get_popup_settings(
window::Id(0),
window::Id::MAIN,
new_id,
None,
None,
Expand All @@ -152,8 +150,7 @@ impl cosmic::Application for Power {
Command::none()
}
Message::Action(action) => {
self.id_ctr += 1;
let id = window::Id(self.id_ctr);
let id = window::Id::unique();
self.action_to_confirm = Some((id, action, COUNTDOWN_LENGTH));
get_layer_surface(SctkLayerSurfaceSettings {
id,
Expand Down
8 changes: 3 additions & 5 deletions cosmic-applet-status-area/src/components/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ struct App {
menus: BTreeMap<usize, status_menu::State>,
open_menu: Option<usize>,
max_menu_id: usize,
max_popup_id: u128,
popup: Option<window::Id>,
}

Expand All @@ -45,14 +44,13 @@ impl App {
}

fn next_popup_id(&mut self) -> window::Id {
self.max_popup_id += 1;
window::Id(self.max_popup_id)
window::Id::unique()
}

fn resize_window(&self) -> Command<Msg> {
let icon_size = self.core.applet.suggested_size().0 as u32 + APPLET_PADDING * 2;
let n = self.menus.len() as u32;
resize_window(window::Id(0), 1.max(icon_size * n), icon_size)
resize_window(window::Id::MAIN, 1.max(icon_size * n), icon_size)
}
}

Expand Down Expand Up @@ -144,7 +142,7 @@ impl cosmic::Application for App {
if self.popup.is_none() {
let id = self.next_popup_id();
let popup_settings = self.core.applet.get_popup_settings(
window::Id(0),
window::Id::MAIN,
id,
None,
None,
Expand Down
6 changes: 2 additions & 4 deletions cosmic-applet-tiling/src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ pub struct Window {
core: Core,
popup: Option<Id>,
timeline: Timeline,
id_ctr: u128,
tile_windows: bool,
active_hint: spin_button::Model<i32>,
gaps: spin_button::Model<i32>,
Expand Down Expand Up @@ -95,13 +94,12 @@ impl cosmic::Application for Window {
return if let Some(p) = self.popup.take() {
destroy_popup(p)
} else {
self.id_ctr += 1;
let new_id = Id(self.id_ctr);
let new_id = Id::unique();
self.popup.replace(new_id);
let mut popup_settings =
self.core
.applet
.get_popup_settings(Id(0), new_id, None, None, None);
.get_popup_settings(Id::MAIN, new_id, None, None, None);
popup_settings.positioner.size_limits = Limits::NONE
.max_width(372.0)
.min_width(300.0)
Expand Down
7 changes: 2 additions & 5 deletions cosmic-applet-time/src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ enum Every {
pub struct Window {
core: cosmic::app::Core,
popup: Option<window::Id>,
id_ctr: u128,
update_at: Every,
now: DateTime<Local>,
rectangle_tracker: Option<RectangleTracker<u32>>,
Expand Down Expand Up @@ -69,7 +68,6 @@ impl cosmic::Application for Window {
Self {
core,
popup: None,
id_ctr: 0,
update_at: Every::Minute,
now: Local::now(),
rectangle_tracker: None,
Expand Down Expand Up @@ -126,12 +124,11 @@ impl cosmic::Application for Window {
if let Some(p) = self.popup.take() {
destroy_popup(p)
} else {
self.id_ctr += 1;
let new_id = window::Id(self.id_ctr);
let new_id = window::Id::unique();
self.popup.replace(new_id);

let mut popup_settings = self.core.applet.get_popup_settings(
window::Id(0),
window::Id::MAIN,
new_id,
None,
None,
Expand Down
2 changes: 1 addition & 1 deletion cosmic-applet-workspaces/src/components/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use cosmic::iced::alignment::{Horizontal, Vertical};
use cosmic::iced::event;
use cosmic::iced::mouse::{self, ScrollDelta};
use cosmic::iced::widget::{button, column, container, row, text};
use cosmic::iced::{subscription, Event::Mouse, Length, Subscription};
use cosmic::iced::{Event::Mouse, Length, Subscription};
use cosmic::iced_core::Background;
use cosmic::iced_style::application;
use cosmic::{applet::cosmic_panel_config::PanelAnchor, font::FONT_BOLD, Command};
Expand Down

0 comments on commit e5db5ab

Please sign in to comment.