Add X11 events logging for debug purpose
Compiled out by default, just to be used for debugging local builds.
This commit is contained in:
parent
828898867f
commit
2a638a9cdf
1 changed files with 60 additions and 12 deletions
|
@ -88,6 +88,13 @@
|
|||
#define VALUATOR_TILTX 3
|
||||
#define VALUATOR_TILTY 4
|
||||
|
||||
//#define DISPLAY_SERVER_X11_DEBUG_LOGS_ENABLED
|
||||
#ifdef DISPLAY_SERVER_X11_DEBUG_LOGS_ENABLED
|
||||
#define DEBUG_LOG_X11(...) printf(__VA_ARGS__)
|
||||
#else
|
||||
#define DEBUG_LOG_X11(...)
|
||||
#endif
|
||||
|
||||
static const double abs_resolution_mult = 10000.0;
|
||||
static const double abs_resolution_range_mult = 10.0;
|
||||
|
||||
|
@ -2346,6 +2353,11 @@ void OS_X11::_poll_events() {
|
|||
void OS_X11::process_xevents() {
|
||||
//printf("checking events %i\n", XPending(x11_display));
|
||||
|
||||
#ifdef DISPLAY_SERVER_X11_DEBUG_LOGS_ENABLED
|
||||
static int frame = 0;
|
||||
++frame;
|
||||
#endif
|
||||
|
||||
do_mouse_warp = false;
|
||||
|
||||
// Is the current mouse mode one where it needs to be grabbed.
|
||||
|
@ -2526,30 +2538,45 @@ void OS_X11::process_xevents() {
|
|||
XFreeEventData(x11_display, &event.xcookie);
|
||||
|
||||
switch (event.type) {
|
||||
case Expose:
|
||||
Main::force_redraw();
|
||||
break;
|
||||
case Expose: {
|
||||
DEBUG_LOG_X11("[%u] Expose window=%lu, count='%u' \n", frame, event.xexpose.window, event.xexpose.count);
|
||||
|
||||
Main::force_redraw();
|
||||
} break;
|
||||
|
||||
case NoExpose: {
|
||||
DEBUG_LOG_X11("[%u] NoExpose drawable=%lu \n", frame, event.xnoexpose.drawable);
|
||||
|
||||
case NoExpose:
|
||||
minimized = true;
|
||||
break;
|
||||
} break;
|
||||
|
||||
case VisibilityNotify: {
|
||||
DEBUG_LOG_X11("[%u] VisibilityNotify window=%lu, state=%u \n", frame, event.xvisibility.window, event.xvisibility.state);
|
||||
|
||||
XVisibilityEvent *visibility = (XVisibilityEvent *)&event;
|
||||
minimized = (visibility->state == VisibilityFullyObscured);
|
||||
} break;
|
||||
|
||||
case LeaveNotify: {
|
||||
DEBUG_LOG_X11("[%u] LeaveNotify window=%lu, mode='%u' \n", frame, event.xcrossing.window, event.xcrossing.mode);
|
||||
|
||||
if (main_loop && !mouse_mode_grab) {
|
||||
main_loop->notification(MainLoop::NOTIFICATION_WM_MOUSE_EXIT);
|
||||
}
|
||||
|
||||
} break;
|
||||
|
||||
case EnterNotify: {
|
||||
DEBUG_LOG_X11("[%u] EnterNotify window=%lu, mode='%u' \n", frame, event.xcrossing.window, event.xcrossing.mode);
|
||||
|
||||
if (main_loop && !mouse_mode_grab) {
|
||||
main_loop->notification(MainLoop::NOTIFICATION_WM_MOUSE_ENTER);
|
||||
}
|
||||
} break;
|
||||
case FocusIn:
|
||||
|
||||
case FocusIn: {
|
||||
DEBUG_LOG_X11("[%u] FocusIn window=%lu, mode='%u' \n", frame, event.xfocus.window, event.xfocus.mode);
|
||||
|
||||
minimized = false;
|
||||
window_has_focus = true;
|
||||
main_loop->notification(MainLoop::NOTIFICATION_WM_FOCUS_IN);
|
||||
|
@ -2580,9 +2607,11 @@ void OS_X11::process_xevents() {
|
|||
MutexLock mutex_lock(events_mutex);
|
||||
XSetICFocus(xic);
|
||||
}
|
||||
break;
|
||||
} break;
|
||||
|
||||
case FocusOut: {
|
||||
DEBUG_LOG_X11("[%u] FocusOut window=%lu, mode='%u' \n", frame, event.xfocus.window, event.xfocus.mode);
|
||||
|
||||
case FocusOut:
|
||||
window_has_focus = false;
|
||||
input->release_pressed_events();
|
||||
main_loop->notification(MainLoop::NOTIFICATION_WM_FOCUS_OUT);
|
||||
|
@ -2618,11 +2647,14 @@ void OS_X11::process_xevents() {
|
|||
MutexLock mutex_lock(events_mutex);
|
||||
XUnsetICFocus(xic);
|
||||
}
|
||||
break;
|
||||
} break;
|
||||
|
||||
case ConfigureNotify: {
|
||||
DEBUG_LOG_X11("[%u] ConfigureNotify window=%lu, event=%lu, above=%lu, override_redirect=%u \n", frame, event.xconfigure.window, event.xconfigure.event, event.xconfigure.above, event.xconfigure.override_redirect);
|
||||
|
||||
case ConfigureNotify:
|
||||
_window_changed(&event);
|
||||
break;
|
||||
} break;
|
||||
|
||||
case ButtonPress:
|
||||
case ButtonRelease: {
|
||||
/* exit in case of a mouse button press */
|
||||
|
@ -2649,6 +2681,8 @@ void OS_X11::process_xevents() {
|
|||
mb->set_pressed((event.type == ButtonPress));
|
||||
|
||||
if (event.type == ButtonPress) {
|
||||
DEBUG_LOG_X11("[%u] ButtonPress window=%lu, button_index=%u \n", frame, event.xbutton.window, mb->get_button_index());
|
||||
|
||||
uint64_t diff = get_ticks_usec() / 1000 - last_click_ms;
|
||||
|
||||
if (mb->get_button_index() == last_click_button_index) {
|
||||
|
@ -2667,6 +2701,8 @@ void OS_X11::process_xevents() {
|
|||
last_click_ms += diff;
|
||||
last_click_pos = Point2(event.xbutton.x, event.xbutton.y);
|
||||
}
|
||||
} else {
|
||||
DEBUG_LOG_X11("[%u] ButtonRelease window=%lu, button_index=%u \n", frame, event.xbutton.window, mb->get_button_index());
|
||||
}
|
||||
|
||||
input->parse_input_event(mb);
|
||||
|
@ -2788,13 +2824,21 @@ void OS_X11::process_xevents() {
|
|||
}
|
||||
|
||||
} break;
|
||||
|
||||
case KeyPress:
|
||||
case KeyRelease: {
|
||||
#ifdef DISPLAY_SERVER_X11_DEBUG_LOGS_ENABLED
|
||||
if (event.type == KeyPress) {
|
||||
DEBUG_LOG_X11("[%u] KeyPress window=%lu, keycode=%u, time=%lu \n", frame, event.xkey.window, event.xkey.keycode, event.xkey.time);
|
||||
} else {
|
||||
DEBUG_LOG_X11("[%u] KeyRelease window=%lu, keycode=%u, time=%lu \n", frame, event.xkey.window, event.xkey.keycode, event.xkey.time);
|
||||
}
|
||||
#endif
|
||||
last_timestamp = event.xkey.time;
|
||||
|
||||
// key event is a little complex, so
|
||||
// it will be handled in its own function.
|
||||
_handle_key_event((XKeyEvent *)&event, events, event_index);
|
||||
_handle_key_event(&event.xkey, events, event_index);
|
||||
} break;
|
||||
|
||||
case SelectionNotify:
|
||||
|
@ -3003,6 +3047,8 @@ String OS_X11::_get_clipboard_impl(Atom p_source, Window x11_window, Atom target
|
|||
|
||||
if (type == XInternAtom(x11_display, "INCR", 0)) {
|
||||
// Data is going to be received incrementally.
|
||||
DEBUG_LOG_X11("INCR selection started.\n");
|
||||
|
||||
LocalVector<uint8_t> incr_data;
|
||||
uint32_t data_size = 0;
|
||||
bool success = false;
|
||||
|
@ -3031,6 +3077,8 @@ String OS_X11::_get_clipboard_impl(Atom p_source, Window x11_window, Atom target
|
|||
&len, &bytes_left, // data length
|
||||
&data);
|
||||
|
||||
DEBUG_LOG_X11("PropertyNotify: len=%lu, format=%i\n", len, format);
|
||||
|
||||
if (result == Success) {
|
||||
if (data && (len > 0)) {
|
||||
uint32_t prev_size = incr_data.size();
|
||||
|
|
Loading…
Reference in a new issue