mirror of
https://github.com/hyprwm/Hypr.git
synced 2024-11-22 13:35:57 +01:00
Configure request, rounding fixes and bar fixes
This commit is contained in:
parent
1e16487db0
commit
57a85553ab
6 changed files with 45 additions and 4 deletions
|
@ -164,6 +164,9 @@ void CStatusBar::setupTray() {
|
|||
XCB_CW_BACK_PIXEL | XCB_CW_BORDER_PIXEL | XCB_CW_OVERRIDE_REDIRECT | XCB_CW_COLORMAP,
|
||||
values);
|
||||
|
||||
xcb_atom_t dockAtom[] = {HYPRATOMS["_NET_WM_WINDOW_TYPE_UTILITY"]};
|
||||
xcb_ewmh_set_wm_window_type(g_pWindowManager->EWMHConnection, m_iWindowID, 1, dockAtom);
|
||||
|
||||
const uint32_t ORIENTATION = 0; // Horizontal
|
||||
xcb_change_property(g_pWindowManager->DisplayConnection, XCB_PROP_MODE_REPLACE, trayWindowID,
|
||||
HYPRATOMS["_NET_SYSTEM_TRAY_ORIENTATION"], XCB_ATOM_CARDINAL,
|
||||
|
@ -366,6 +369,7 @@ void CStatusBar::destroy() {
|
|||
saveTrayOnDestroy();
|
||||
|
||||
xcb_close_font(g_pWindowManager->DisplayConnection, m_mContexts["HITEXT"].Font);
|
||||
xcb_unmap_window(g_pWindowManager->DisplayConnection, m_iWindowID);
|
||||
xcb_destroy_window(g_pWindowManager->DisplayConnection, m_iWindowID);
|
||||
xcb_destroy_window(g_pWindowManager->DisplayConnection, m_iPixmap);
|
||||
|
||||
|
|
|
@ -620,6 +620,27 @@ void Events::eventClientMessage(xcb_generic_event_t* event) {
|
|||
xcb_map_window(g_pWindowManager->DisplayConnection, CLIENT);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Events::eventConfigureRequest(xcb_generic_event_t* event) {
|
||||
const auto E = reinterpret_cast<xcb_configure_request_event_t*>(event);
|
||||
|
||||
RETURNIFBAR;
|
||||
|
||||
const auto PWINDOW = g_pWindowManager->getWindowFromDrawable(E->window);
|
||||
|
||||
if (!PWINDOW || !PWINDOW->getIsFloating())
|
||||
return;
|
||||
|
||||
// correct delta
|
||||
auto DELTA = PWINDOW->getDefaultSize() - Vector2D(E->width, E->height);
|
||||
|
||||
PWINDOW->setDefaultSize(Vector2D(E->width, E->height));
|
||||
PWINDOW->setDefaultPosition(PWINDOW->getDefaultPosition() - (DELTA / 2.f)); // Center
|
||||
|
||||
PWINDOW->setPosition(PWINDOW->getDefaultPosition());
|
||||
PWINDOW->setSize(PWINDOW->getDefaultSize());
|
||||
|
||||
PWINDOW->setRealPosition(PWINDOW->getDefaultPosition());
|
||||
PWINDOW->setRealSize(PWINDOW->getDefaultSize());
|
||||
}
|
|
@ -16,6 +16,7 @@ namespace Events {
|
|||
EVENT(KeyPress);
|
||||
EVENT(MotionNotify);
|
||||
EVENT(ClientMessage);
|
||||
EVENT(ConfigureRequest);
|
||||
|
||||
// Bypass some events for floating windows
|
||||
CWindow* remapWindow(int, bool floating = false, int forcemonitor = -1);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "window.hpp"
|
||||
#include "windowManager.hpp"
|
||||
|
||||
CWindow::CWindow() { this->setLastUpdatePosition(Vector2D(0,0)); this->setLastUpdateSize(Vector2D(0,0)); this->setDock(false); this->setUnderFullscreen(false); this->setIsSleeping(true); this->setFirstAnimFrame(true); this->setIsAnimated(false); this->setDead(false); this->setMasterChildIndex(0); this->setMaster(false); this->setCanKill(false); this->setImmovable(false); this->setNoInterventions(false); this->setDirty(true); this->setFullscreen(false); this->setIsFloating(false); this->setParentNodeID(0); this->setChildNodeAID(0); this->setChildNodeBID(0); this->setName(""); }
|
||||
CWindow::CWindow() { this->setRounded(false); this->setLastUpdatePosition(Vector2D(0,0)); this->setLastUpdateSize(Vector2D(0,0)); this->setDock(false); this->setUnderFullscreen(false); this->setIsSleeping(true); this->setFirstAnimFrame(true); this->setIsAnimated(false); this->setDead(false); this->setMasterChildIndex(0); this->setMaster(false); this->setCanKill(false); this->setImmovable(false); this->setNoInterventions(false); this->setDirty(true); this->setFullscreen(false); this->setIsFloating(false); this->setParentNodeID(0); this->setChildNodeAID(0); this->setChildNodeBID(0); this->setName(""); }
|
||||
CWindow::~CWindow() { }
|
||||
|
||||
void CWindow::generateNodeID() {
|
||||
|
|
|
@ -94,6 +94,9 @@ public:
|
|||
// Docks
|
||||
EXPOSED_MEMBER(Dock, bool, b);
|
||||
|
||||
// Rounding
|
||||
EXPOSED_MEMBER(Rounded, bool, b);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -264,6 +264,10 @@ void CWindowManager::recieveEvent() {
|
|||
Events::eventMapWindow(ev);
|
||||
Debug::log(LOG, "Event dispatched MAP");
|
||||
break;
|
||||
case XCB_CONFIGURE_REQUEST:
|
||||
Events::eventConfigureRequest(ev);
|
||||
Debug::log(LOG, "Event dispatched CONFIGURE_REQUEST");
|
||||
break;
|
||||
case XCB_BUTTON_PRESS:
|
||||
Events::eventButtonPress(ev);
|
||||
Debug::log(LOG, "Event dispatched BUTTON_PRESS");
|
||||
|
@ -407,7 +411,6 @@ void CWindowManager::refreshDirtyWindows() {
|
|||
Values[0] = (int)ConfigManager::getInt("border_size");
|
||||
xcb_configure_window(DisplayConnection, window.getDrawable(), XCB_CONFIG_WINDOW_BORDER_WIDTH, Values);
|
||||
|
||||
|
||||
// do border
|
||||
Values[0] = window.getRealBorderColor().getAsUint32();
|
||||
xcb_change_window_attributes(DisplayConnection, window.getDrawable(), XCB_CW_BORDER_PIXEL, Values);
|
||||
|
@ -437,7 +440,6 @@ void CWindowManager::refreshDirtyWindows() {
|
|||
}
|
||||
|
||||
applyShapeToWindow(&window);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -609,6 +611,13 @@ void CWindowManager::applyShapeToWindow(CWindow* pWindow) {
|
|||
|
||||
const auto ROUNDING = pWindow->getFullscreen() ? 0 : ConfigManager::getInt("rounding");
|
||||
|
||||
if (!pWindow->getRounded() && !ROUNDING)
|
||||
return;
|
||||
|
||||
if (!ROUNDING && pWindow->getRounded()) {
|
||||
pWindow->setRounded(false);
|
||||
}
|
||||
|
||||
const auto SHAPEQUERY = xcb_get_extension_data(DisplayConnection, &xcb_shape_id);
|
||||
|
||||
if (!SHAPEQUERY || !SHAPEQUERY->present || pWindow->getNoInterventions())
|
||||
|
@ -696,6 +705,9 @@ void CWindowManager::applyShapeToWindow(CWindow* pWindow) {
|
|||
|
||||
xcb_free_pixmap(DisplayConnection, PIXMAP1);
|
||||
xcb_free_pixmap(DisplayConnection, PIXMAP2);
|
||||
|
||||
if (ROUNDING)
|
||||
pWindow->setRounded(true);
|
||||
}
|
||||
|
||||
void CWindowManager::setEffectiveSizePosUsingConfig(CWindow* pWindow) {
|
||||
|
|
Loading…
Reference in a new issue