mirror of
https://github.com/hyprwm/Hypr.git
synced 2024-12-24 18:39:47 +01:00
Root window now has a cursor
This commit is contained in:
parent
1e4b54f3f0
commit
3180ad2104
5 changed files with 24 additions and 6 deletions
|
@ -25,5 +25,6 @@ target_link_libraries(Hypr
|
|||
xcb-keysyms
|
||||
xcb-randr
|
||||
xcb-xinerama
|
||||
xcb-cursor
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
)
|
|
@ -26,7 +26,7 @@ Hypr is a Linux tiling window manager for Xorg. It's written in XCB with modern
|
|||
- [ ] Upgrade the status bar rendering to Cairo
|
||||
- [ ] Better status bar configability
|
||||
- [ ] Rounded corners
|
||||
- [ ] Replace default X11 cursor with the pointer
|
||||
- [x] Replace default X11 cursor with the pointer
|
||||
- [x] Fix ghost windows once and for all
|
||||
- [ ] Fix windows minimizing themselves to tray not being able to come back without pkill
|
||||
- [x] Moving windows between workspaces without floating
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <xcb/xinerama.h>
|
||||
#include <xcb/xcb_event.h>
|
||||
#include <xcb/xcb_util.h>
|
||||
#include <xcb/xcb_cursor.h>
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
|
|
@ -15,13 +15,23 @@ xcb_visualtype_t* CWindowManager::setupColors() {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void CWindowManager::updateRootCursor() {
|
||||
if (xcb_cursor_context_new(DisplayConnection, Screen, &pointerContext) < 0) {
|
||||
Debug::log(ERR, "Creating a cursor context failed!");
|
||||
return;
|
||||
}
|
||||
|
||||
pointerCursor = xcb_cursor_load_cursor(pointerContext, "left_ptr");
|
||||
|
||||
Debug::log(LOG, "Cursor created with ID " + std::to_string(pointerCursor));
|
||||
|
||||
// Set the cursor
|
||||
uint32_t values[1] = { pointerCursor };
|
||||
xcb_change_window_attributes(DisplayConnection, Screen->root, XCB_CW_CURSOR, values);
|
||||
}
|
||||
|
||||
void CWindowManager::setupRandrMonitors() {
|
||||
|
||||
// TODO: this stopped working on my machine for some reason.
|
||||
// i3 works though...?
|
||||
|
||||
// finds 0 monitors
|
||||
|
||||
XCBQUERYCHECK(RANDRVER, xcb_randr_query_version_reply(
|
||||
DisplayConnection, xcb_randr_query_version(DisplayConnection, XCB_RANDR_MAJOR_VERSION, XCB_RANDR_MINOR_VERSION), &errorRANDRVER), "RandR query failed!" );
|
||||
|
||||
|
@ -160,6 +170,8 @@ void CWindowManager::setupManager() {
|
|||
|
||||
ConfigManager::loadConfigLoadVars();
|
||||
|
||||
updateRootCursor();
|
||||
|
||||
Debug::log(LOG, "Finished setup!");
|
||||
|
||||
// TODO: EWMH
|
||||
|
|
|
@ -46,6 +46,9 @@ public:
|
|||
std::atomic<bool> mainThreadBusy = false;
|
||||
std::atomic<bool> animationUtilBusy = false;
|
||||
|
||||
xcb_cursor_t pointerCursor;
|
||||
xcb_cursor_context_t* pointerContext;
|
||||
|
||||
CWindow* getWindowFromDrawable(int64_t);
|
||||
void addWindowToVectorSafe(CWindow);
|
||||
void removeWindowFromVectorSafe(int64_t);
|
||||
|
@ -100,6 +103,7 @@ public:
|
|||
void cleanupUnusedWorkspaces();
|
||||
xcb_visualtype_t* setupColors();
|
||||
void updateBarInfo();
|
||||
void updateRootCursor();
|
||||
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue