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_DEBUG_KEYBOARD 0x00050003
|
||||
#define GLFW_DEBUG_RENDERING 0x00050004
|
||||
/*! @brief macOS specific init 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 GLFWerrorfun _glfwErrorCallback;
|
||||
static _GLFWinitconfig _glfwInitHints =
|
||||
{
|
||||
true, // hat buttons
|
||||
GLFW_ANGLE_PLATFORM_TYPE_NONE, // ANGLE backend
|
||||
false, // debug keyboard
|
||||
{
|
||||
true, // macOS menu bar
|
||||
true // macOS bundle chdir
|
||||
static _GLFWinitconfig _glfwInitHints = {
|
||||
.hatButtons = true,
|
||||
.angleType = GLFW_ANGLE_PLATFORM_TYPE_NONE,
|
||||
.debugKeyboard = false,
|
||||
.debugRendering = false,
|
||||
.ns = {
|
||||
.menubar = true, // macOS menu bar
|
||||
.chdir = true // macOS bundle chdir
|
||||
}
|
||||
};
|
||||
|
||||
@ -285,6 +285,9 @@ GLFWAPI void glfwInitHint(int hint, int value)
|
||||
case GLFW_DEBUG_KEYBOARD:
|
||||
_glfwInitHints.debugKeyboard = value;
|
||||
return;
|
||||
case GLFW_DEBUG_RENDERING:
|
||||
_glfwInitHints.debugRendering = value;
|
||||
return;
|
||||
case GLFW_COCOA_CHDIR_RESOURCES:
|
||||
_glfwInitHints.ns.chdir = value;
|
||||
return;
|
||||
|
||||
1
glfw/internal.h
vendored
1
glfw/internal.h
vendored
@ -276,6 +276,7 @@ struct _GLFWinitconfig
|
||||
bool hatButtons;
|
||||
int angleType;
|
||||
bool debugKeyboard;
|
||||
bool debugRendering;
|
||||
struct {
|
||||
bool menubar;
|
||||
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;
|
||||
enum xdg_toplevel_state* state;
|
||||
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);
|
||||
|
||||
wl_array_for_each(state, states) {
|
||||
@ -446,7 +446,7 @@ static void xdgToplevelHandleConfigure(void* data,
|
||||
}
|
||||
window->wl.toplevel_states = new_states;
|
||||
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);
|
||||
dispatchChangesAfterConfigure(window, width, height);
|
||||
_glfwInputWindowFocus(window, window->wl.toplevel_states & TOPLEVEL_STATE_ACTIVATED);
|
||||
|
||||
@ -546,7 +546,7 @@ def glfw_terminate() -> None:
|
||||
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
|
||||
|
||||
|
||||
|
||||
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_DEBUG_KEYBOARD 0x00050003
|
||||
#define GLFW_DEBUG_RENDERING 0x00050004
|
||||
/*! @brief macOS specific init 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*
|
||||
glfw_init(PyObject UNUSED *self, PyObject *args) {
|
||||
const char* path;
|
||||
int debug_keyboard = 0;
|
||||
if (!PyArg_ParseTuple(args, "s|p", &path, &debug_keyboard)) return NULL;
|
||||
int debug_keyboard = 0, debug_rendering = 0;
|
||||
if (!PyArg_ParseTuple(args, "s|pp", &path, &debug_keyboard, &debug_rendering)) return NULL;
|
||||
const char* err = load_glfw(path);
|
||||
if (err) { PyErr_SetString(PyExc_RuntimeError, err); return NULL; }
|
||||
glfwSetErrorCallback(error_callback);
|
||||
glfwInitHint(GLFW_DEBUG_KEYBOARD, debug_keyboard);
|
||||
glfwInitHint(GLFW_DEBUG_RENDERING, debug_rendering);
|
||||
OPT(debug_keyboard) = debug_keyboard != 0;
|
||||
#ifdef __APPLE__
|
||||
glfwInitHint(GLFW_COCOA_CHDIR_RESOURCES, 0);
|
||||
|
||||
@ -93,14 +93,14 @@ def load_all_shaders(semi_transparent: bool = False) -> None:
|
||||
load_borders_program()
|
||||
|
||||
|
||||
def init_glfw_module(glfw_module: str, debug_keyboard: bool = False) -> None:
|
||||
if not glfw_init(glfw_path(glfw_module), debug_keyboard):
|
||||
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, debug_rendering):
|
||||
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')
|
||||
init_glfw_module(glfw_module, debug_keyboard)
|
||||
init_glfw_module(glfw_module, debug_keyboard, debug_rendering)
|
||||
return glfw_module
|
||||
|
||||
|
||||
@ -313,7 +313,7 @@ def _main() -> None:
|
||||
return
|
||||
bad_lines: List[BadLine] = []
|
||||
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)
|
||||
try:
|
||||
with setup_profiling(cli_opts):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user