revert X Property change, and cleanup formatting

This commit is contained in:
Ashley Wulber 2021-12-29 17:31:01 -05:00
parent 5a4a802751
commit 65f43a9300
32 changed files with 459 additions and 429 deletions

View file

@ -1,10 +1,9 @@
use gtk4 as gtk;
use glib::subclass::InitializingObject;
use gtk::prelude::*;
use gtk::subclass::prelude::*;
use gtk::{gio, glib};
use gtk::{CompositeTemplate, Entry, ListView};
use gtk4 as gtk;
use gtk::prelude::*;
use gtk::subclass::prelude::*;
use once_cell::sync::OnceCell;
// Object holding the state
@ -34,6 +33,7 @@ impl ObjectSubclass for Window {
obj.init_template();
}
}
// Trait shared by all GObjects
impl ObjectImpl for Window {
fn constructed(&self, obj: &Self::Type) {
@ -46,6 +46,7 @@ impl ObjectImpl for Window {
obj.setup_factory();
}
}
// Trait shared by all widgets
impl WidgetImpl for Window {}

View file

@ -1,24 +1,25 @@
mod imp;
use crate::search_result_row::SearchResultRow;
use crate::SearchResultObject;
use crate::TX;
use crate::X11_CONN;
use gdk4::Rectangle;
use gdk4_x11::X11Display;
use gdk4_x11::X11Surface;
use glib::Object;
use gtk::prelude::*;
use gtk::subclass::prelude::*;
use gtk::{gio, glib};
use gtk::{Application, SignalListItemFactory};
use gtk4 as gtk;
use libcosmic::x;
use gtk::prelude::*;
use gtk::subclass::prelude::*;
use postage::prelude::Sink;
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::search_result_row::SearchResultRow;
use crate::SearchResultObject;
use crate::TX;
use crate::X11_CONN;
mod imp;
glib::wrapper! {
pub struct Window(ObjectSubclass<imp::Window>)
@ -143,16 +144,15 @@ impl Window {
// ignore all x11 errors...
let xdisplay = display.clone().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();

View file

@ -1,26 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="LauncherWindow" parent="GtkApplicationWindow">
<property name="width-request">600</property>
<property name="title">Gtk Pop Launcher</property>
<property name="decorated">false</property>
<property name="resizable">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">600</property>
<property name="title">Gtk Pop Launcher</property>
<property name="decorated">false</property>
<property name="resizable">false</property>
<child>
<object class="GtkEntry" id="entry">
<property name="margin-bottom">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="GtkEntry" id="entry">
<property name="margin-bottom">12</property>
</object>
</child>
<child>
<object class="GtkListView" id="list_view"/>
</child>
</object>
</child>
<child>
<object class="GtkListView" id="list_view"/>
</child>
</object>
</child>
</template>
</template>
</interface>