(X11) Mouse input is no longer registered when we are on the

titlebar of the window or we are no longer inside the window
This commit is contained in:
twinaphex 2016-10-03 06:50:00 +02:00
parent 7f1c9b33ef
commit 91b1889873
3 changed files with 36 additions and 21 deletions

View File

@ -56,6 +56,7 @@ static bool g_x11_has_focus;
static XIM g_x11_xim;
static XIC g_x11_xic;
static bool g_x11_true_full;
bool g_x11_entered = false;
unsigned g_x11_screen;
@ -647,6 +648,14 @@ bool x11_alive(void *data)
}
break;
case EnterNotify:
g_x11_entered = true;
break;
case LeaveNotify:
g_x11_entered = false;
break;
case ButtonRelease:
break;

View File

@ -481,6 +481,7 @@ static bool gfx_ctx_x_set_video_mode(void *data,
swa.colormap = g_x11_cmap = XCreateColormap(g_x11_dpy,
RootWindow(g_x11_dpy, vi->screen), vi->visual, AllocNone);
swa.event_mask = StructureNotifyMask | KeyPressMask | KeyReleaseMask |
LeaveWindowMask | EnterWindowMask |
ButtonReleaseMask | ButtonPressMask;
swa.override_redirect = fullscreen ? True : False;

View File

@ -300,6 +300,8 @@ static void x_input_free(void *data)
free(x11);
}
extern bool g_x11_entered;
static void x_input_poll_mouse(x11_input_t *x11)
{
unsigned mask;
@ -316,6 +318,8 @@ static void x_input_poll_mouse(x11_input_t *x11)
&win_x, &win_y,
&mask);
if (g_x11_entered)
{
x11->mouse_x = win_x;
x11->mouse_y = win_y;
x11->mouse_l = mask & Button1Mask;
@ -343,6 +347,7 @@ static void x_input_poll_mouse(x11_input_t *x11)
x11->mouse_last_y = mid_h;
}
}
}
static void x_input_poll(void *data)