Skip to content

Commit

Permalink
Support the decorations field from the _MOTIF_WM_HINTS prop (Attempt y…
Browse files Browse the repository at this point in the history
…shui#2 using just a type and comparing the 2nd index)
  • Loading branch information
arielnmz committed Apr 19, 2021
1 parent 7ba8759 commit cb562d8
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/atom.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
_NET_WM_STATE, \
_NET_WM_STATE_FULLSCREEN, \
_NET_WM_BYPASS_COMPOSITOR, \
_MOTIF_WM_HINTS, \
UTF8_STRING, \
C_STRING
// clang-format on
Expand Down
2 changes: 2 additions & 0 deletions src/c2.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ struct _c2_l {
C2_L_TWINDOW,
C2_L_TATOM,
C2_L_TDRAWABLE,
C2_L_TMOTIFHINTS,
} type;
int format;
enum { C2_L_PTUNDEFINED,
Expand Down Expand Up @@ -1298,6 +1299,7 @@ static xcb_atom_t c2_get_atom_type(const c2_l_t *pleaf) {
case C2_L_TSTRING: return XCB_ATOM_STRING;
case C2_L_TATOM: return XCB_ATOM_ATOM;
case C2_L_TDRAWABLE: return XCB_ATOM_DRAWABLE;
case C2_L_TMOTIFHINTS: return XCB_ATOM_CARDINAL;
default: assert(0); break;
}
unreachable;
Expand Down
47 changes: 47 additions & 0 deletions tests/testcases/wm_motif_hints.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/bin/env python

import xcffib.xproto as xproto
import xcffib
import time
from common import set_window_name, to_atom
import struct

def set_MOTIF_WM_HINTS(conn, wid, hints):
struct.pack('LLLLL',*hints)
prop_name = to_atom(conn, "_MOTIF_WM_HINTS")
str_type = to_atom(conn, "_MOTIF_WM_HINTS")
conn.core.ChangePropertyChecked(xproto.PropMode.Replace, wid, prop_name, str_type, 32, len(hints), hints).check()


conn = xcffib.connect()
setup = conn.get_setup()
root = setup.roots[0].root
visual = setup.roots[0].root_visual
depth = setup.roots[0].root_depth

# making sure disabling shadow while screen is unredirected doesn't cause assertion failure
wid = conn.generate_id()

# Create a window
conn.core.CreateWindowChecked(depth, wid, root, 0, 0, 100, 100, 0, xproto.WindowClass.InputOutput, visual, 0, []).check()

# Set Window name
set_window_name(conn, wid, "WM MOTIF HINTS TEST")

# Set WM MOTIF HINTS
set_MOTIF_WM_HINTS(conn, wid, (2, 1, 0, 0, 0))

# Map the window
conn.core.MapWindowChecked(wid).check()

# Idle loop

try:
while True:
# Running
time.sleep(0.1)
except KeyboardInterrupt:
pass

# Destroy the window
conn.core.DestroyWindowChecked(wid).check()

0 comments on commit cb562d8

Please sign in to comment.