~eliasnaur/gio-patches

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH] app/internal/window: fully remove direct pointer arithmetic in x11 driver

Details
Message ID
<20191107130854.25391-1-db047h@gmail.com>
DKIM signature
missing
Download raw message
Patch: +2 -9
Signed-off-by: Denis Bernard <db047h@gmail.com>
---
 app/internal/window/os_x11.go | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/app/internal/window/os_x11.go b/app/internal/window/os_x11.go
index e176849..7b81a76 100644
--- a/app/internal/window/os_x11.go
+++ b/app/internal/window/os_x11.go
@@ -12,8 +12,6 @@ package window
#include <X11/Xatom.h>
#include <X11/Xutil.h>
#include <X11/Xresource.h>
#define GIO_FIELD_OFFSET(typ, field) const int gio_##typ##_##field##_off = offsetof(typ, field)
GIO_FIELD_OFFSET(XClientMessageEvent, data);

void gio_x11_init_ime(Display *dpy, Window win, XIM *xim, XIC *xic) {
	// adjust locale temporarily for XOpenIM
@@ -323,7 +321,8 @@ func (h *x11EventHandler) handleEvents() bool {
			w.height = int(cevt.height)
			// redraw will be done by a later expose event
		case C.ClientMessage: // extensions
			switch GetClientDataLong(xev)[0] {
			cevt := (*C.XClientMessageEvent)(unsafe.Pointer(xev))
			switch *(*C.long)(unsafe.Pointer(&cevt.data)) {
			case C.long(w.evDelWindow):
				w.dead = true
				return false
@@ -379,12 +378,6 @@ func x11SpecialKeySymToRune(s C.KeySym) (rune, bool) {
	return n, true
}

// GetClientDataLong returns a XClientMessageEvent.data.l field.
func GetClientDataLong(e *C.XEvent) [5]C.long {
	ptr := (*[5]C.long)(unsafe.Pointer(uintptr(unsafe.Pointer(e)) + uintptr(C.gio_XClientMessageEvent_data_off)))
	return *ptr
}

var (
	x11Threads sync.Once
)
-- 
2.17.1
Details
Message ID
<BY9P45QSA7O7.32CWQI1OY4A64@toolbox>
In-Reply-To
<20191107130854.25391-1-db047h@gmail.com> (view parent)
DKIM signature
missing
Download raw message
Thank you. I'm going to squash this with your previous pointer arithmetic
change.
Review patch Export thread (mbox)