jichu4n / basic_wm Goto Github PK
View Code? Open in Web Editor NEWAn example basic X11 window manager.
An example basic X11 window manager.
Alt + Left Click: Move window
Alt + Right Click: Resize window
Alt + F4: Close window
Alt + Tab: Switch window
ctrl+shift grabs mouse and keyboard showing in Xephyr window title
/usr/bin/ld: /tmp/ccaISolJ.o: in function `main':
main.cpp:(.text+0x2a): undefined reference to `google::InitGoogleLogging(char const*)'
/usr/bin/ld: main.cpp:(.text+0x66): undefined reference to `google::LogMessage::LogMessage(char const*, int, int)'
/usr/bin/ld: main.cpp:(.text+0x72): undefined reference to `google::LogMessage::stream()'
/usr/bin/ld: main.cpp:(.text+0x8d): undefined reference to `google::LogMessage::~LogMessage()'
/usr/bin/ld: main.cpp:(.text+0xdb): undefined reference to `google::LogMessage::~LogMessage()'
/usr/bin/ld: /tmp/ccRXsZzt.o: in function `WindowManager::Create()':
window_manager.cpp:(.text+0x22): undefined reference to `XOpenDisplay'
/usr/bin/ld: window_manager.cpp:(.text+0x4a): undefined reference to `google::LogMessage::LogMessage(char const*, int, int)'
/usr/bin/ld: window_manager.cpp:(.text+0x56): undefined reference to `google::LogMessage::stream()'
/usr/bin/ld: window_manager.cpp:(.text+0x72): undefined reference to `XDisplayName'
/usr/bin/ld: window_manager.cpp:(.text+0x89): undefined reference to `google::LogMessage::~LogMessage()'
/usr/bin/ld: window_manager.cpp:(.text+0xda): undefined reference to `google::LogMessage::~LogMessage()'
/usr/bin/ld: /tmp/ccRXsZzt.o: in function `WindowManager::~WindowManager()':
window_manager.cpp:(.text+0x1a7): undefined reference to `XCloseDisplay'
/usr/bin/ld: /tmp/ccRXsZzt.o: in function `_XDisplay*& google::CheckNotNull<_XDisplay*&>(char const*, int, char const*, _XDisplay*&)':
window_manager.cpp:(.text._ZN6google12CheckNotNullIRP9_XDisplayEET_PKciS6_OS4_[_ZN6google12CheckNotNullIRP9_XDisplayEET_PKciS6_OS4_]+0x86): undefined reference to `google::LogMessageFatal::LogMessageFatal(char const*, int, google::CheckOpString const&)'
/usr/bin/ld: window_manager.cpp:(.text._ZN6google12CheckNotNullIRP9_XDisplayEET_PKciS6_OS4_[_ZN6google12CheckNotNullIRP9_XDisplayEET_PKciS6_OS4_]+0x92): undefined reference to `google::LogMessageFatal::~LogMessageFatal()'
collect2: error: ld returned 1 exit status
help
I am successfully getting the border at the top thicker, however it's colour is the same as the window background, I want it ti be the same has the border colour.
Here's my windowManager::Frame
void WindowManager::Frame(Window w, bool was_created_before_window_manager) {
// Visual properties of the frame to create.
const unsigned int BORDER_WIDTH = 3;
const unsigned long BORDER_COLOR = 0x80808080; //0xff0000;
const unsigned long BG_COLOR = 0xFFFFFFF; //0x0000ff;
// We shouldn't be framing windows we've already framed.
CHECK(!clients_.count(w));
// 1. Retrieve attributes of window to frame.
XWindowAttributes x_window_attrs;
CHECK(XGetWindowAttributes(display_, w, &x_window_attrs));
// 2. If window was created before window manager started, we should frame
// it only if it is visible and doesn't set override_redirect.
if (was_created_before_window_manager) {
if (x_window_attrs.override_redirect ||
x_window_attrs.map_state != IsViewable) {
return;
}
}
// 3. Create frame.
const Window frame = XCreateSimpleWindow(
display_,
root_,
x_window_attrs.x,
x_window_attrs.y,
x_window_attrs.width,
x_window_attrs.height + BORDER_WIDTH + BORDER_WIDTH * BORDER_WIDTH * 2,
BORDER_WIDTH,
BORDER_COLOR,
BG_COLOR);
// 4. Select events on frame.
XSelectInput(
display_,
frame,
SubstructureRedirectMask | SubstructureNotifyMask);
// 5. Add client to save set, so that it will be restored and kept alive if we
// crash.
XAddToSaveSet(display_, w);
// 6. Reparent client window.
XReparentWindow(
display_,
w,
frame,
0, 0+BORDER_WIDTH + BORDER_WIDTH * BORDER_WIDTH * 2); // Offset of client window within frame.
// 7. Map frame.
XMapWindow(display_, frame);
// 8. Save frame handle.
clients_[w] = frame;
// 9. Grab universal window management actions on client window.
// a. Move windows with alt + left button.
XGrabButton(
display_,
Button1,
Mod1Mask,
w,
false,
ButtonPressMask | ButtonReleaseMask | ButtonMotionMask,
GrabModeAsync,
GrabModeAsync,
None,
None);
// b. Resize windows with alt + right button.
XGrabButton(
display_,
Button3,
Mod1Mask,
w,
false,
ButtonPressMask | ButtonReleaseMask | ButtonMotionMask,
GrabModeAsync,
GrabModeAsync,
None,
None);
// c. Kill windows with alt + f4.
XGrabKey(
display_,
XKeysymToKeycode(display_, XK_F4),
Mod1Mask,
w,
false,
GrabModeAsync,
GrabModeAsync);
// d. Switch windows with alt + tab.
XGrabKey(
display_,
XKeysymToKeycode(display_, XK_Tab),
Mod1Mask,
w,
false,
GrabModeAsync,
GrabModeAsync);
LOG(INFO) << "Framed window " << w << " [" << frame << "]";
}
Now I need to somehow fill the space at the top with a filled rectangle with the border colour
Hello sir, I can't appear to access the entirety of your series because the links to parts 2 and 3 are broken. Is there another place I can read your articles? Would love to follow along to help me with my implementation of re-creating Microsoft's power toys fancyzones :-)
I do CTRL + SHIFT to grab mouse/keyboard, but when i do the shortcuts in the README, nothing happen
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.