Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add files via upload #1

Merged
merged 1 commit into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 45 additions & 3 deletions xcb_trl.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,13 +341,13 @@ XCBGetWindowGeometryReply(XCBDisplay *display, XCBGeometryCookie cookie)


inline XCBAtomCookie
XCBInternalAtomCookie(XCBDisplay *display, const char *name, int only_if_exists)
XCBInternAtomCookie(XCBDisplay *display, const char *name, int only_if_exists)
{
return xcb_intern_atom(display, only_if_exists, strlen(name), name);
}

inline XCBAtom
XCBInternalAtomReply(XCBDisplay *display, XCBAtomCookie cookie)
XCBInternAtomReply(XCBDisplay *display, XCBAtomCookie cookie)
{
XCBGenericError **e = NULL;
xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply(display, cookie, e);
Expand Down Expand Up @@ -508,6 +508,18 @@ XCBPollForQueuedEvent(XCBDisplay *display)
}


inline XCBPointerCookie
XCBQueryPointerCookie(XCBDisplay *display, XCBWindow window)
{
return xcb_query_pointer(display, window);
}

inline XCBPointerReply
XCBQueryPointerReply(XCBDisplay *display, XCBPointerCookie cookie)
{
XCBGenericError **err;
return xcb_query_pointer_reply(display, cookie, err);
}


inline XCBCookie
Expand All @@ -528,7 +540,7 @@ u8 depth, unsigned int class, XCBVisualId visual, u32 valuemask, const u32 *valu
return id;
}

inline XCBGC
inline XCBGC
XCBCreateGC(XCBDisplay *display, XCBDrawable drawable,
u32 valuemask, const void *valuelist)
{
Expand All @@ -537,6 +549,36 @@ u32 valuemask, const void *valuelist)
return id;
}

inline int
XCBSetLineAttributes(XCBDisplay *display, XCBGC gc, u32 linewidth, u32 linestyle, u32 capstyle, u32 joinstyle)
{
u32 gcvalist[3];
int index = 0;
//gcvalist = { linestyle, capstyle, joinstyle };
u32 mask = 0;
if(linewidth)
{ mask |= XCB_GC_LINE_WIDTH;
gcvalist[index++] = linewidth;
}
if(capstyle)
{ mask |= XCB_GC_CAP_STYLE;
gcvalist[index++] = capstyle;
}
if(joinstyle)
{ mask |= XCB_GC_JOIN_STYLE;
gcvalist[index++] = joinstyle;
}

/* This returns a cookie but changing the gc isnt doesnt really require a reply as you are directly manupulating your own gc
* However the XServer Doesnt know that yet which is why a cookie is returned
* (void) is cast cause we dont care about the cookie i.e. unused
*/
(void)xcb_change_gc(display, gc, mask, gcvalist);
/* X11 src/SetLStyle.c always returns 1 (for some reason) */
return 1;
}


inline XCBCookie
XCBChangeGC(XCBDisplay *display, XCBGC gc, u32 valuemask, const void *valuelist)
{
Expand Down
31 changes: 28 additions & 3 deletions xcb_trl.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include <xcb/xcb_ewmh.h>
#include <xcb/xcb_keysyms.h>
#include <xcb/xcb_cursor.h>
#include <xcb/xinerama.h>


typedef xcb_connection_t XCBConnection;
typedef xcb_connection_t XCBDisplay;
Expand Down Expand Up @@ -42,6 +44,21 @@ typedef xcb_font_t XCBFont;
typedef xcb_generic_event_t XCBGenericEvent;
typedef xcb_generic_error_t XCBGenericError;

typedef xcb_query_pointer_cookie_t XCBPointerCookie;
typedef xcb_query_pointer_reply_t XCBPointerReply;

/* Xinerama */

typedef xcb_xinerama_screen_info_t XCBXineramaScreenInfo;
typedef xcb_xinerama_is_active_cookie_t XCBXineramaIsActiveCookie;
typedef xcb_xinerama_is_active_reply_t XCBXineramaIsActiveReply;

typedef xcb_xinerama_query_screens_reply_t XCBXineramaQueryScreensReply;
typedef xcb_xinerama_query_screens_cookie_t XCBXineramaQueryScreensCookie;







Expand Down Expand Up @@ -123,6 +140,7 @@ extern uint16_t XCBDisplayWidth(XCBDisplay *display, int screen);
*/
extern uint16_t XCBDisplayHeight(XCBDisplay *display, int screen);
extern uint8_t XCBDisplayDepth(XCBDisplay *display, int screen);
extern uint8_t XCBDefaultDepth(XCBDisplay *display, int screen);
extern XCBCookie XCBSelectInput(XCBDisplay *display, XCBWindow window, uint32_t mask);
/*
*/
Expand All @@ -139,6 +157,8 @@ extern XCBCookie XCBRaiseWindowIf(XCBDisplay *display, XCBWindow window);
extern XCBCookie XCBLowerWindowIf(XCBDisplay *display, XCBWindow window);
extern XCBCookie XCBSetWindowBorderWidth(XCBDisplay *display, XCBWindow window, uint32_t border_width);
extern XCBCookie XCBSetSibling(XCBDisplay *display, XCBWindow window, XCBWindow sibling);
extern XCBAtomCookie XCBInternAtomCookie(XCBDisplay *display, const char *name, int only_if_exists);
extern XCBAtom XCBInternAtomReply(XCBDisplay *display, XCBAtomCookie cookie);

extern XCBWindowAttributesCookie XGetWindowAttributesCookie(XCBDisplay *display, XCBWindow window);
extern XCBWindowAttributes *XCBGetWindowAttributesReply(XCBDisplay *display, XCBWindowAttributesCookie cookie);
Expand All @@ -150,7 +170,8 @@ extern XCBCursor XCBCreateFontCursor(XCBDisplay *display, int shape);
extern XCBCookie XCBFreeCursor(XCBDisplay *display, XCBCursor cursor);



extern XCBPointerCookie XCBQueryPointerCookie(XCBDisplay *display);
extern XCBPointerReply XCBQueryPointerReply(XCBDisplay *display, XCBPointerCookie cookie);
/* fonts */
/**/
extern XCBCookie XCBOpenFont(XCBDisplay *display, XCBFont id, const char *name);
Expand Down Expand Up @@ -273,9 +294,13 @@ extern XCBCookie XCBMapWindow(XCBDisplay *display, XCBWindow window);

/* windows*/
extern XCBWindow XCBCreateWindow(XCBDisplay *display, XCBWindow parent, int x, int y, unsigned int width, unsigned int height, int border_width, uint8_t depth, unsigned int _class, XCBVisualId visual, uint32_t valuemask, const uint32_t *value_list);


/* GC */
extern XCBGC XCBCreateGC(XCBDisplay *display, XCBDrawable drawable,
uint32_t valuemask, const void *valuelist);
/* RETURN: GC id (identification number) */
extern XCBGC XCBCreateGC(XCBDisplay *display, XCBDrawable drawable, uint32_t valuemask, const void *valuelist);
/* RETURN: 1, always cause why not */
extern int XCBSetLineAttributes(XCBDisplay *display, XCBGC gc, uint32_t linewidth, uint32_t linestyle, uint32_t capstyle, uint32_t joinstyle);

/* Valuemasks
XCB_GC_FUNCTION
Expand Down