mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-23 02:25:59 +01:00
handle activate requests
This commit is contained in:
parent
0d7d7a970d
commit
2c714eace5
5 changed files with 35 additions and 7 deletions
|
@ -170,6 +170,8 @@ CCompositor::CCompositor() {
|
||||||
m_sWLRTextInputMgr = wlr_text_input_manager_v3_create(m_sWLDisplay);
|
m_sWLRTextInputMgr = wlr_text_input_manager_v3_create(m_sWLDisplay);
|
||||||
|
|
||||||
m_sWLRIMEMgr = wlr_input_method_manager_v2_create(m_sWLDisplay);
|
m_sWLRIMEMgr = wlr_input_method_manager_v2_create(m_sWLDisplay);
|
||||||
|
|
||||||
|
m_sWLRActivation = wlr_xdg_activation_v1_create(m_sWLDisplay);
|
||||||
}
|
}
|
||||||
|
|
||||||
CCompositor::~CCompositor() {
|
CCompositor::~CCompositor() {
|
||||||
|
@ -226,6 +228,7 @@ void CCompositor::initAllSignals() {
|
||||||
addWLSignal(&m_sWLROutputPowerMgr->events.set_mode, &Events::listen_powerMgrSetMode, m_sWLROutputPowerMgr, "PowerMgr");
|
addWLSignal(&m_sWLROutputPowerMgr->events.set_mode, &Events::listen_powerMgrSetMode, m_sWLROutputPowerMgr, "PowerMgr");
|
||||||
addWLSignal(&m_sWLRIMEMgr->events.input_method, &Events::listen_newIME, m_sWLRIMEMgr, "IMEMgr");
|
addWLSignal(&m_sWLRIMEMgr->events.input_method, &Events::listen_newIME, m_sWLRIMEMgr, "IMEMgr");
|
||||||
addWLSignal(&m_sWLRTextInputMgr->events.text_input, &Events::listen_newTextInput, m_sWLRTextInputMgr, "TextInputMgr");
|
addWLSignal(&m_sWLRTextInputMgr->events.text_input, &Events::listen_newTextInput, m_sWLRTextInputMgr, "TextInputMgr");
|
||||||
|
addWLSignal(&m_sWLRActivation->events.request_activate, &Events::listen_activateXDG, m_sWLRActivation, "ActivationV1");
|
||||||
|
|
||||||
if(m_sWRLDRMLeaseMgr)
|
if(m_sWRLDRMLeaseMgr)
|
||||||
addWLSignal(&m_sWRLDRMLeaseMgr->events.request, &Events::listen_leaseRequest, &m_sWRLDRMLeaseMgr, "DRM");
|
addWLSignal(&m_sWRLDRMLeaseMgr->events.request, &Events::listen_leaseRequest, &m_sWRLDRMLeaseMgr, "DRM");
|
||||||
|
|
|
@ -69,6 +69,7 @@ public:
|
||||||
wlr_output_power_manager_v1* m_sWLROutputPowerMgr;
|
wlr_output_power_manager_v1* m_sWLROutputPowerMgr;
|
||||||
wlr_input_method_manager_v2* m_sWLRIMEMgr;
|
wlr_input_method_manager_v2* m_sWLRIMEMgr;
|
||||||
wlr_text_input_manager_v3* m_sWLRTextInputMgr;
|
wlr_text_input_manager_v3* m_sWLRTextInputMgr;
|
||||||
|
wlr_xdg_activation_v1* m_sWLRActivation;
|
||||||
// ------------------------------------------------- //
|
// ------------------------------------------------- //
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -60,6 +60,7 @@ void CConfigManager::setDefaultVars() {
|
||||||
configValues["misc:disable_autoreload"].intValue = 0;
|
configValues["misc:disable_autoreload"].intValue = 0;
|
||||||
configValues["misc:enable_swallow"].intValue = 0;
|
configValues["misc:enable_swallow"].intValue = 0;
|
||||||
configValues["misc:swallow_regex"].strValue = STRVAL_EMPTY;
|
configValues["misc:swallow_regex"].strValue = STRVAL_EMPTY;
|
||||||
|
configValues["misc:focus_on_activate"].intValue = 1;
|
||||||
|
|
||||||
configValues["debug:int"].intValue = 0;
|
configValues["debug:int"].intValue = 0;
|
||||||
configValues["debug:log_damage"].intValue = 0;
|
configValues["debug:log_damage"].intValue = 0;
|
||||||
|
|
|
@ -42,6 +42,7 @@ namespace Events {
|
||||||
|
|
||||||
// Surface XDG (window)
|
// Surface XDG (window)
|
||||||
LISTENER(newXDGSurface);
|
LISTENER(newXDGSurface);
|
||||||
|
LISTENER(activateXDG);
|
||||||
|
|
||||||
// Window events
|
// Window events
|
||||||
DYNLISTENFUNC(commitWindow);
|
DYNLISTENFUNC(commitWindow);
|
||||||
|
@ -87,7 +88,6 @@ namespace Events {
|
||||||
LISTENER(requestMouse);
|
LISTENER(requestMouse);
|
||||||
LISTENER(requestSetSel);
|
LISTENER(requestSetSel);
|
||||||
LISTENER(requestSetPrimarySel);
|
LISTENER(requestSetPrimarySel);
|
||||||
DYNLISTENFUNC(activate);
|
|
||||||
|
|
||||||
// outputMgr
|
// outputMgr
|
||||||
LISTENER(outputMgrApply);
|
LISTENER(outputMgrApply);
|
||||||
|
|
|
@ -688,16 +688,39 @@ void Events::listener_fullscreenWindow(void* owner, void* data) {
|
||||||
g_pXWaylandManager->setWindowFullscreen(PWINDOW, PWINDOW->m_bIsFullscreen);
|
g_pXWaylandManager->setWindowFullscreen(PWINDOW, PWINDOW->m_bIsFullscreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::listener_activate(void* owner, void* data) {
|
void Events::listener_activateXDG(wl_listener* listener, void* data) {
|
||||||
// TODO
|
const auto E = (wlr_xdg_activation_v1_request_activate_event*)data;
|
||||||
|
|
||||||
|
static auto *const PFOCUSONACTIVATE = &g_pConfigManager->getConfigValuePtr("misc:focus_on_activate")->intValue;
|
||||||
|
|
||||||
|
Debug::log(LOG, "Activate request for surface at %x", E->surface);
|
||||||
|
|
||||||
|
if (!*PFOCUSONACTIVATE || !wlr_surface_is_xdg_surface(E->surface))
|
||||||
|
return;
|
||||||
|
|
||||||
|
const auto PWINDOW = g_pCompositor->getWindowFromSurface(E->surface);
|
||||||
|
|
||||||
|
if (!PWINDOW)
|
||||||
|
return;
|
||||||
|
|
||||||
|
g_pCompositor->focusWindow(PWINDOW);
|
||||||
|
Vector2D middle = PWINDOW->m_vRealPosition.goalv() + PWINDOW->m_vRealSize.goalv() / 2.f;
|
||||||
|
g_pCompositor->warpCursorTo(middle);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::listener_activateX11(void* owner, void* data) {
|
void Events::listener_activateX11(void* owner, void* data) {
|
||||||
CWindow* PWINDOW = (CWindow*)owner;
|
const auto PWINDOW = (CWindow*)owner;
|
||||||
|
|
||||||
if (PWINDOW->m_iX11Type == 1 /* Managed */) {
|
static auto *const PFOCUSONACTIVATE = &g_pConfigManager->getConfigValuePtr("misc:focus_on_activate")->intValue;
|
||||||
wlr_xwayland_surface_activate(PWINDOW->m_uSurface.xwayland, 1);
|
|
||||||
}
|
Debug::log(LOG, "X11 Activate request for window %x", PWINDOW);
|
||||||
|
|
||||||
|
if (!*PFOCUSONACTIVATE || PWINDOW->m_iX11Type != 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
g_pCompositor->focusWindow(PWINDOW);
|
||||||
|
Vector2D middle = PWINDOW->m_vRealPosition.goalv() + PWINDOW->m_vRealSize.goalv() / 2.f;
|
||||||
|
g_pCompositor->warpCursorTo(middle);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::listener_configureX11(void* owner, void* data) {
|
void Events::listener_configureX11(void* owner, void* data) {
|
||||||
|
|
Loading…
Reference in a new issue