revert X Property change, and cleanup formatting
This commit is contained in:
parent
5a4a802751
commit
65f43a9300
32 changed files with 459 additions and 429 deletions
|
|
@ -1,13 +1,13 @@
|
|||
use gtk4 as gtk;
|
||||
use gtk4::ScrolledWindow;
|
||||
use std::fs::File;
|
||||
|
||||
use glib::signal::Inhibit;
|
||||
use glib::subclass::InitializingObject;
|
||||
use gtk::prelude::*;
|
||||
use gtk::subclass::prelude::*;
|
||||
use gtk::{gio, glib};
|
||||
use gtk::{CompositeTemplate, GridView, SearchEntry};
|
||||
use gtk4 as gtk;
|
||||
use gtk4::ScrolledWindow;
|
||||
use gtk::prelude::*;
|
||||
use gtk::subclass::prelude::*;
|
||||
use once_cell::sync::OnceCell;
|
||||
|
||||
use crate::app_group::AppGroup;
|
||||
|
|
@ -45,6 +45,7 @@ impl ObjectSubclass for Window {
|
|||
obj.init_template();
|
||||
}
|
||||
}
|
||||
|
||||
// Trait shared by all GObjects
|
||||
impl ObjectImpl for Window {
|
||||
fn constructed(&self, obj: &Self::Type) {
|
||||
|
|
@ -58,6 +59,7 @@ impl ObjectImpl for Window {
|
|||
obj.setup_factory();
|
||||
}
|
||||
}
|
||||
|
||||
// Trait shared by all widgets
|
||||
impl WidgetImpl for Window {}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,31 +1,33 @@
|
|||
mod imp;
|
||||
use crate::app_group::AppGroup;
|
||||
use crate::app_group::AppGroupData;
|
||||
use crate::grid_item::GridItem;
|
||||
use crate::utils::data_path;
|
||||
use crate::utils::set_group_scroll_policy;
|
||||
use crate::X11_CONN;
|
||||
use std::fs::File;
|
||||
|
||||
use gdk4::Rectangle;
|
||||
use gdk4_x11::X11Display;
|
||||
use gdk4_x11::X11Surface;
|
||||
use glib::FromVariant;
|
||||
use glib::Object;
|
||||
use glib::Variant;
|
||||
use gtk::prelude::*;
|
||||
use gtk::subclass::prelude::*;
|
||||
use gtk::{gio, glib};
|
||||
use gtk::{Application, SignalListItemFactory};
|
||||
use gtk4 as gtk;
|
||||
use gtk4::Dialog;
|
||||
use gtk4::Entry;
|
||||
use gtk4::Label;
|
||||
use libcosmic::x;
|
||||
use std::fs::File;
|
||||
use gtk::prelude::*;
|
||||
use gtk::subclass::prelude::*;
|
||||
use x11rb::connection::Connection;
|
||||
use x11rb::protocol::xproto;
|
||||
use x11rb::protocol::xproto::ConnectionExt as OtherConnectionExt;
|
||||
use x11rb::protocol::xproto::*;
|
||||
use x11rb::wrapper::ConnectionExt;
|
||||
use x11rb::protocol::xproto::ConnectionExt;
|
||||
|
||||
use libcosmic::x;
|
||||
|
||||
use crate::app_group::AppGroup;
|
||||
use crate::app_group::AppGroupData;
|
||||
use crate::grid_item::GridItem;
|
||||
use crate::utils::data_path;
|
||||
use crate::utils::set_group_scroll_policy;
|
||||
use crate::X11_CONN;
|
||||
|
||||
mod imp;
|
||||
|
||||
glib::wrapper! {
|
||||
pub struct Window(ObjectSubclass<imp::Window>)
|
||||
|
|
@ -170,10 +172,10 @@ impl Window {
|
|||
category: "".to_string(),
|
||||
}),
|
||||
]
|
||||
.iter()
|
||||
.for_each(|group| {
|
||||
group_model.append(group);
|
||||
});
|
||||
.iter()
|
||||
.for_each(|group| {
|
||||
group_model.append(group);
|
||||
});
|
||||
let group_selection = gtk4::SingleSelection::new(Some(&group_model));
|
||||
imp.group_grid_view.set_model(Some(&group_selection));
|
||||
}
|
||||
|
|
@ -407,27 +409,15 @@ impl Window {
|
|||
.downcast::<X11Display>()
|
||||
.expect("Failed to downgrade X11 Display.");
|
||||
xdisplay.error_trap_push();
|
||||
let conn = X11_CONN.get().expect("Failed to get X11 connection");
|
||||
let window_type_atom = conn
|
||||
.intern_atom(false, b"_NET_WM_WINDOW_TYPE")
|
||||
.unwrap()
|
||||
.reply()
|
||||
.unwrap()
|
||||
.atom;
|
||||
let dock_type_atom = conn
|
||||
.intern_atom(false, b"_NET_WM_WINDOW_TYPE_DIALOG")
|
||||
.unwrap()
|
||||
.reply()
|
||||
.unwrap()
|
||||
.atom;
|
||||
conn.change_property32(
|
||||
PropMode::REPLACE,
|
||||
surface.xid().try_into().unwrap(),
|
||||
window_type_atom,
|
||||
AtomEnum::ATOM,
|
||||
&[dock_type_atom],
|
||||
)
|
||||
.unwrap();
|
||||
unsafe {
|
||||
x::change_property(
|
||||
&display,
|
||||
&surface,
|
||||
"_NET_WM_WINDOW_TYPE",
|
||||
x::PropMode::Replace,
|
||||
&[x::Atom::new(&display, "_NET_WM_WINDOW_TYPE_DIALOG").unwrap()],
|
||||
);
|
||||
}
|
||||
let resize = glib::clone!(@weak window => move || {
|
||||
let s = window.surface().expect("Failed to get Surface for Window");
|
||||
let height = window.height();
|
||||
|
|
|
|||
|
|
@ -1,66 +1,66 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<template class="LauncherWindow" parent="GtkApplicationWindow">
|
||||
<property name="width-request">1200</property>
|
||||
<property name="title">Pop App Library</property>
|
||||
<property name="decorated">false</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="margin-top">12</property>
|
||||
<property name="margin-bottom">12</property>
|
||||
<property name="margin-start">12</property>
|
||||
<property name="margin-end">12</property>
|
||||
<template class="LauncherWindow" parent="GtkApplicationWindow">
|
||||
<property name="width-request">1200</property>
|
||||
<property name="title">Pop App Library</property>
|
||||
<property name="decorated">false</property>
|
||||
<child>
|
||||
<object class="GtkSearchEntry" id="entry">
|
||||
<property name="width-request">300</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="margin-bottom">12</property>
|
||||
<property name="margin-top">12</property>
|
||||
</object>
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="margin-top">12</property>
|
||||
<property name="margin-bottom">12</property>
|
||||
<property name="margin-start">12</property>
|
||||
<property name="margin-end">12</property>
|
||||
<child>
|
||||
<object class="GtkSearchEntry" id="entry">
|
||||
<property name="width-request">300</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="margin-bottom">12</property>
|
||||
<property name="margin-top">12</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<property name="min-content-height">500</property>
|
||||
<property name="vexpand">true</property>
|
||||
<property name="margin-top">12</property>
|
||||
<child>
|
||||
<object class="GtkGridView" id="app_grid_view">
|
||||
<property name="min-columns">7</property>
|
||||
<property name="max-columns">7</property>
|
||||
<property name="single-click-activate">false</property>
|
||||
<property name="enable-rubberband">false</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparator">
|
||||
<property name="orientation">horizontal</property>
|
||||
<property name="hexpand">true</property>
|
||||
<property name="margin-bottom">12</property>
|
||||
<property name="margin-top">12</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="group_scroll_window">
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<property name="vscrollbar-policy">never</property>
|
||||
<property name="propagate-natural-height">true</property>
|
||||
<property name="min-content-height">150</property>
|
||||
<property name="max-content-height">300</property>
|
||||
<child>
|
||||
<object class="GtkGridView" id="group_grid_view">
|
||||
<property name="min-columns">8</property>
|
||||
<property name="max-columns">8</property>
|
||||
<property name="single-click-activate">false</property>
|
||||
<property name="enable-rubberband">false</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<property name="min-content-height">500</property>
|
||||
<property name="vexpand">true</property>
|
||||
<property name="margin-top">12</property>
|
||||
<child>
|
||||
<object class="GtkGridView" id="app_grid_view">
|
||||
<property name="min-columns">7</property>
|
||||
<property name="max-columns">7</property>
|
||||
<property name="single-click-activate">false</property>
|
||||
<property name="enable-rubberband">false</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparator">
|
||||
<property name="orientation">horizontal</property>
|
||||
<property name="hexpand">true</property>
|
||||
<property name="margin-bottom">12</property>
|
||||
<property name="margin-top">12</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="group_scroll_window">
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<property name="vscrollbar-policy">never</property>
|
||||
<property name="propagate-natural-height">true</property>
|
||||
<property name="min-content-height">150</property>
|
||||
<property name="max-content-height">300</property>
|
||||
<child>
|
||||
<object class="GtkGridView" id="group_grid_view">
|
||||
<property name="min-columns">8</property>
|
||||
<property name="max-columns">8</property>
|
||||
<property name="single-click-activate">false</property>
|
||||
<property name="enable-rubberband">false</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</template>
|
||||
</template>
|
||||
</interface>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue