picom
picom copied to clipboard
core: separate work with the x extensions
- a todo is addressed: https://github.com/yshui/picom/blob/16486739fa9daa5964e1bba5baa551da622999d7/src/x.c#L67
- unused information about the x extensions (base event and error numbers, major opcode) is not stored anymore;
- information about the x extensions (presence, base event and error numbers) is now stored in a single, separate place - a structure called
x_extensionsthat lives in thex_connectionstructure, so thesessionstructure is less polluted. it's ordered and clean so it's clear how to add and/or remove the x extensions; - the x extensions are now initialized in a single, separate place - a function called
x_init_extensionsthat is called right after thex_init_connectionfunction, so thesession_initfunction is less polluted. it's ordered and clean so it's clear how to add and/or remove the x extensions. also it separates initialization from work (only initialization happens there, all the work left in thesession_initfunction), has comments (when a particular x extension initialization happens, why we require particular versions of particular x extensions and why we sometimes negotiate versions of x extensions just to discard this information) and has a better error handling (when a required x extension is missing or something goes wrong it at least tries to free what's already allocated instead of immediately dying usingexit(1)and leaking a bunch of stuff); --diagnosticsreports presence of all the optional x extensions in the same way now;- the
win_update_bounding_shapefunction doesn't requireshape_existsthat indicates the x shape extension presence, it determines it itself usingc; - the
x_error_code_to_stringfunction doesn't useps_ganymore, it usescinstead; - the x extensions used by picomling are now properly initialized and a picomling won't born if one of them is missing.