Allow toggling xdg configure debug output at runtime
This commit is contained in:
parent
bf3fc5fb92
commit
850a8218db
1
glfw/glfw3.h
vendored
1
glfw/glfw3.h
vendored
@ -1110,6 +1110,7 @@ typedef enum {
|
|||||||
*/
|
*/
|
||||||
#define GLFW_ANGLE_PLATFORM_TYPE 0x00050002
|
#define GLFW_ANGLE_PLATFORM_TYPE 0x00050002
|
||||||
#define GLFW_DEBUG_KEYBOARD 0x00050003
|
#define GLFW_DEBUG_KEYBOARD 0x00050003
|
||||||
|
#define GLFW_DEBUG_RENDERING 0x00050004
|
||||||
/*! @brief macOS specific init hint.
|
/*! @brief macOS specific init hint.
|
||||||
*
|
*
|
||||||
* macOS specific [init hint](@ref GLFW_COCOA_CHDIR_RESOURCES_hint).
|
* macOS specific [init hint](@ref GLFW_COCOA_CHDIR_RESOURCES_hint).
|
||||||
|
|||||||
19
glfw/init.c
vendored
19
glfw/init.c
vendored
@ -50,14 +50,14 @@ _GLFWlibrary _glfw = { false };
|
|||||||
//
|
//
|
||||||
static _GLFWerror _glfwMainThreadError;
|
static _GLFWerror _glfwMainThreadError;
|
||||||
static GLFWerrorfun _glfwErrorCallback;
|
static GLFWerrorfun _glfwErrorCallback;
|
||||||
static _GLFWinitconfig _glfwInitHints =
|
static _GLFWinitconfig _glfwInitHints = {
|
||||||
{
|
.hatButtons = true,
|
||||||
true, // hat buttons
|
.angleType = GLFW_ANGLE_PLATFORM_TYPE_NONE,
|
||||||
GLFW_ANGLE_PLATFORM_TYPE_NONE, // ANGLE backend
|
.debugKeyboard = false,
|
||||||
false, // debug keyboard
|
.debugRendering = false,
|
||||||
{
|
.ns = {
|
||||||
true, // macOS menu bar
|
.menubar = true, // macOS menu bar
|
||||||
true // macOS bundle chdir
|
.chdir = true // macOS bundle chdir
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -285,6 +285,9 @@ GLFWAPI void glfwInitHint(int hint, int value)
|
|||||||
case GLFW_DEBUG_KEYBOARD:
|
case GLFW_DEBUG_KEYBOARD:
|
||||||
_glfwInitHints.debugKeyboard = value;
|
_glfwInitHints.debugKeyboard = value;
|
||||||
return;
|
return;
|
||||||
|
case GLFW_DEBUG_RENDERING:
|
||||||
|
_glfwInitHints.debugRendering = value;
|
||||||
|
return;
|
||||||
case GLFW_COCOA_CHDIR_RESOURCES:
|
case GLFW_COCOA_CHDIR_RESOURCES:
|
||||||
_glfwInitHints.ns.chdir = value;
|
_glfwInitHints.ns.chdir = value;
|
||||||
return;
|
return;
|
||||||
|
|||||||
1
glfw/internal.h
vendored
1
glfw/internal.h
vendored
@ -276,6 +276,7 @@ struct _GLFWinitconfig
|
|||||||
bool hatButtons;
|
bool hatButtons;
|
||||||
int angleType;
|
int angleType;
|
||||||
bool debugKeyboard;
|
bool debugKeyboard;
|
||||||
|
bool debugRendering;
|
||||||
struct {
|
struct {
|
||||||
bool menubar;
|
bool menubar;
|
||||||
bool chdir;
|
bool chdir;
|
||||||
|
|||||||
4
glfw/wl_window.c
vendored
4
glfw/wl_window.c
vendored
@ -407,7 +407,7 @@ static void xdgToplevelHandleConfigure(void* data,
|
|||||||
float targetRatio;
|
float targetRatio;
|
||||||
enum xdg_toplevel_state* state;
|
enum xdg_toplevel_state* state;
|
||||||
uint32_t new_states = 0;
|
uint32_t new_states = 0;
|
||||||
const bool report_event = true;
|
const bool report_event = _glfw.hints.init.debugRendering;
|
||||||
if (report_event) printf("top-level configure event: size: %dx%d states: ", width, height);
|
if (report_event) printf("top-level configure event: size: %dx%d states: ", width, height);
|
||||||
|
|
||||||
wl_array_for_each(state, states) {
|
wl_array_for_each(state, states) {
|
||||||
@ -446,7 +446,7 @@ static void xdgToplevelHandleConfigure(void* data,
|
|||||||
}
|
}
|
||||||
window->wl.toplevel_states = new_states;
|
window->wl.toplevel_states = new_states;
|
||||||
set_csd_window_geometry(window, &width, &height);
|
set_csd_window_geometry(window, &width, &height);
|
||||||
if (report_event) printf("final window size: %dx%d\n", window->wl.width, window->wl.height);
|
if (report_event) printf("final window content size: %dx%d\n", window->wl.width, window->wl.height);
|
||||||
wl_surface_commit(window->wl.surface);
|
wl_surface_commit(window->wl.surface);
|
||||||
dispatchChangesAfterConfigure(window, width, height);
|
dispatchChangesAfterConfigure(window, width, height);
|
||||||
_glfwInputWindowFocus(window, window->wl.toplevel_states & TOPLEVEL_STATE_ACTIVATED);
|
_glfwInputWindowFocus(window, window->wl.toplevel_states & TOPLEVEL_STATE_ACTIVATED);
|
||||||
|
|||||||
@ -546,7 +546,7 @@ def glfw_terminate() -> None:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def glfw_init(path: str, debug_keyboard: bool = False) -> bool:
|
def glfw_init(path: str, debug_keyboard: bool = False, debug_rendering: bool = False) -> bool:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
1
kitty/glfw-wrapper.h
generated
1
kitty/glfw-wrapper.h
generated
@ -848,6 +848,7 @@ typedef enum {
|
|||||||
*/
|
*/
|
||||||
#define GLFW_ANGLE_PLATFORM_TYPE 0x00050002
|
#define GLFW_ANGLE_PLATFORM_TYPE 0x00050002
|
||||||
#define GLFW_DEBUG_KEYBOARD 0x00050003
|
#define GLFW_DEBUG_KEYBOARD 0x00050003
|
||||||
|
#define GLFW_DEBUG_RENDERING 0x00050004
|
||||||
/*! @brief macOS specific init hint.
|
/*! @brief macOS specific init hint.
|
||||||
*
|
*
|
||||||
* macOS specific [init hint](@ref GLFW_COCOA_CHDIR_RESOURCES_hint).
|
* macOS specific [init hint](@ref GLFW_COCOA_CHDIR_RESOURCES_hint).
|
||||||
|
|||||||
@ -872,12 +872,13 @@ dbus_user_notification_activated(uint32_t notification_id, const char* action) {
|
|||||||
static PyObject*
|
static PyObject*
|
||||||
glfw_init(PyObject UNUSED *self, PyObject *args) {
|
glfw_init(PyObject UNUSED *self, PyObject *args) {
|
||||||
const char* path;
|
const char* path;
|
||||||
int debug_keyboard = 0;
|
int debug_keyboard = 0, debug_rendering = 0;
|
||||||
if (!PyArg_ParseTuple(args, "s|p", &path, &debug_keyboard)) return NULL;
|
if (!PyArg_ParseTuple(args, "s|pp", &path, &debug_keyboard, &debug_rendering)) return NULL;
|
||||||
const char* err = load_glfw(path);
|
const char* err = load_glfw(path);
|
||||||
if (err) { PyErr_SetString(PyExc_RuntimeError, err); return NULL; }
|
if (err) { PyErr_SetString(PyExc_RuntimeError, err); return NULL; }
|
||||||
glfwSetErrorCallback(error_callback);
|
glfwSetErrorCallback(error_callback);
|
||||||
glfwInitHint(GLFW_DEBUG_KEYBOARD, debug_keyboard);
|
glfwInitHint(GLFW_DEBUG_KEYBOARD, debug_keyboard);
|
||||||
|
glfwInitHint(GLFW_DEBUG_RENDERING, debug_rendering);
|
||||||
OPT(debug_keyboard) = debug_keyboard != 0;
|
OPT(debug_keyboard) = debug_keyboard != 0;
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
glfwInitHint(GLFW_COCOA_CHDIR_RESOURCES, 0);
|
glfwInitHint(GLFW_COCOA_CHDIR_RESOURCES, 0);
|
||||||
|
|||||||
@ -93,14 +93,14 @@ def load_all_shaders(semi_transparent: bool = False) -> None:
|
|||||||
load_borders_program()
|
load_borders_program()
|
||||||
|
|
||||||
|
|
||||||
def init_glfw_module(glfw_module: str, debug_keyboard: bool = False) -> None:
|
def init_glfw_module(glfw_module: str, debug_keyboard: bool = False, debug_rendering: bool = False) -> None:
|
||||||
if not glfw_init(glfw_path(glfw_module), debug_keyboard):
|
if not glfw_init(glfw_path(glfw_module), debug_keyboard, debug_rendering):
|
||||||
raise SystemExit('GLFW initialization failed')
|
raise SystemExit('GLFW initialization failed')
|
||||||
|
|
||||||
|
|
||||||
def init_glfw(opts: OptionsStub, debug_keyboard: bool = False) -> str:
|
def init_glfw(opts: OptionsStub, debug_keyboard: bool = False, debug_rendering: bool = False) -> str:
|
||||||
glfw_module = 'cocoa' if is_macos else ('wayland' if is_wayland(opts) else 'x11')
|
glfw_module = 'cocoa' if is_macos else ('wayland' if is_wayland(opts) else 'x11')
|
||||||
init_glfw_module(glfw_module, debug_keyboard)
|
init_glfw_module(glfw_module, debug_keyboard, debug_rendering)
|
||||||
return glfw_module
|
return glfw_module
|
||||||
|
|
||||||
|
|
||||||
@ -313,7 +313,7 @@ def _main() -> None:
|
|||||||
return
|
return
|
||||||
bad_lines: List[BadLine] = []
|
bad_lines: List[BadLine] = []
|
||||||
opts = create_opts(cli_opts, accumulate_bad_lines=bad_lines)
|
opts = create_opts(cli_opts, accumulate_bad_lines=bad_lines)
|
||||||
init_glfw(opts, cli_opts.debug_keyboard)
|
init_glfw(opts, cli_opts.debug_keyboard, cli_opts.debug_rendering)
|
||||||
setup_environment(opts, cli_opts)
|
setup_environment(opts, cli_opts)
|
||||||
try:
|
try:
|
||||||
with setup_profiling(cli_opts):
|
with setup_profiling(cli_opts):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user