Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preview #1

Merged
merged 27 commits into from
Apr 5, 2018
Merged
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
8c27b34
Preview window that follows mouse
Soft Mar 31, 2018
2e2e434
Minimum viable preview window
Soft Apr 2, 2018
b6cb406
Setup shape mask when SHAPE extension is available
Soft Apr 3, 2018
1bc38d7
Make RGB into a struct
Soft Apr 3, 2018
16bb53a
Explicitly unmap preview window
Soft Apr 3, 2018
2a7c818
Set _NET_WM_STATE hints
Soft Apr 3, 2018
dc8cf5c
Add cache for interned atoms, probably not worth it but still nice
Soft Apr 3, 2018
b01be7c
Reorganize
Soft Apr 3, 2018
7968921
Draw borders around the preview window
Soft Apr 3, 2018
795e549
Use native border support for drawing preview borders
Soft Apr 3, 2018
97d7985
Add command line option for disabling preview window.
Soft Apr 3, 2018
2ed8136
Avoid creating unnecessary pixmap for border mask
Soft Apr 3, 2018
a6fddc4
Avoid unnecessary locking in atom cache
Soft Apr 4, 2018
0e2708b
Instead of inverting preview window border color, change it subtly.
Soft Apr 4, 2018
55ed4e9
Only set the X11 core protocol window border if SHAPE is not used
Soft Apr 4, 2018
2375dc8
Set window class
Soft Apr 4, 2018
2cb75d5
Allow disabling preview window
Soft Apr 4, 2018
f052951
Update man page about XCOLOR_DISABLE_SHAPE
Soft Apr 4, 2018
91df79b
Minor clean up
Soft Apr 4, 2018
09deba2
Removed a box from format selection code
Soft Apr 5, 2018
62b8489
Remove unused return values
Soft Apr 5, 2018
2372b70
Clean up
Soft Apr 5, 2018
e93eb48
Remove request_check on some change_property invocations
Soft Apr 5, 2018
ec74d44
Fix disabling preview
Soft Apr 5, 2018
cd88071
Update README with info about the new preview functionality
Soft Apr 5, 2018
6976a3d
Update man page to contain info about the new flags
Soft Apr 5, 2018
122d561
Added a screenshot
Soft Apr 5, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Only set the X11 core protocol window border if SHAPE is not used
  • Loading branch information
Soft committed Apr 4, 2018
commit 55ed4e9bbd6eeb41e10468660dda25507bb69291
12 changes: 8 additions & 4 deletions src/preview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,20 @@ impl<'a> Preview<'a> {
let root = screen.root();

// Intern atoms
let utf8_string = atoms::get(conn, "UTF8_STRING")?;
let net_wm_window_type = atoms::get(conn, "_NET_WM_WINDOW_TYPE")?;
let net_wm_window_type_tooltip = atoms::get(conn, "_NET_WM_WINDOW_TYPE_TOOLTIP")?;
let net_wm_name = atoms::get(conn, "_NET_WM_NAME")?;
let utf8_string = atoms::get(conn, "UTF8_STRING")?;
let net_wm_state = atoms::get(conn, "_NET_WM_STATE")?;
let net_wm_state_above = atoms::get(conn, "_NET_WM_STATE_ABOVE")?;
let net_wm_state_sticky = atoms::get(conn, "_NET_WM_STATE_STICKY")?;
let net_wm_state_skip_taskbar = atoms::get(conn, "_NET_WM_STATE_SKIP_TASKBAR")?;
let net_wm_state_skip_pager = atoms::get(conn, "_NET_WM_STATE_SKIP_PAGER")?;

// Check if SHAPE extension is available and if using it is desired
let shape_ext = conn.get_extension_data(xshape::id());
let use_shaped = use_shaped && shape_ext.map_or(false, |ext| ext.present());

// Create GCs
let values = [ (xproto::GC_FOREGROUND, screen.white_pixel()) ];
let background_gc = conn.generate_id();
Expand All @@ -57,12 +61,13 @@ impl<'a> Preview<'a> {
(xproto::CW_OVERRIDE_REDIRECT, 1)
];

let border_width = if use_shaped { 0 } else { 1 };
xproto::create_window(conn,
xbase::COPY_FROM_PARENT as u8, // Depth
window, // Window
root, // Parent
0, 0, PREVIEW_WIDTH, PREVIEW_HEIGHT, // Size
1, // Border
border_width, // Border
xproto::WINDOW_CLASS_INPUT_OUTPUT as u16, // Class
xbase::COPY_FROM_PARENT, // Visual
&values)
Expand Down Expand Up @@ -111,8 +116,7 @@ impl<'a> Preview<'a> {
.request_check()?;

// Setup shape mask
let shape_ext = conn.get_extension_data(xshape::id());
if use_shaped && shape_ext.map_or(false, |ext| ext.present()) {
if use_shaped {
let transparent = [ (xproto::GC_FOREGROUND, 0) ];
let solid = [ (xproto::GC_FOREGROUND, 1) ];
let rect = xproto::Rectangle::new(0, 0, PREVIEW_WIDTH, PREVIEW_HEIGHT);
Expand Down