Skip to content

Commit

Permalink
Adapt AppKit to use xkbcommon
Browse files Browse the repository at this point in the history
Remove X11 support from LaunchServices.
Add tablet unstable-v2 wayland protocol
mszoek committed Mar 23, 2024
1 parent 0e6d71c commit 9628cf4
Showing 11 changed files with 86 additions and 73 deletions.
6 changes: 4 additions & 2 deletions CoreServices/WindowServer/wayland-protocols/Makefile
@@ -38,11 +38,13 @@ UNSTABLE= idle-inhibit/idle-inhibit-unstable-v1.xml \
xdg-decoration/xdg-decoration-unstable-v1.xml \
fullscreen-shell/fullscreen-shell-unstable-v1.xml \
text-input/text-input-unstable-v1.xml \
text-input/text-input-unstable-v3.xml
text-input/text-input-unstable-v3.xml \
tablet/tablet-unstable-v2.xml

DATADIR= ${OBJTOP}/tmp${PREFIX}/share/wayland-protocols

all:
all: install
build: install

includes:

13 changes: 9 additions & 4 deletions CoreServices/WindowServer/wlroots/Makefile
@@ -179,11 +179,16 @@ INCS=
MK_WERROR= no
WARNS= 1
CFLAGS+= --sysroot=${OBJTOP}/tmp -B${OBJTOP}/tmp/usr/bin \
-I${.CURDIR}/include -I${MAKEOBJDIR} \
-I${.CURDIR}/../wayland/src -I${MAKEOBJDIR}/../wayland/src \
-I${.CURDIR}/../libdrm/include/drm \
-I${.CURDIR}/../libdrm -I${.CURDIR}/../libxkbcommon/include \
-I${.CURDIR}/include -I${MAKEOBJDIR} -I${.CURDIR} \
-I${OBJTOP}/Frameworks/OpenGL/wayland/src \
-I${SRCTOP}/Frameworks/OpenGL/wayland/src \
-I${SRCTOP}/Frameworks/OpenGL/libdrm \
-I${SRCTOP}/Frameworks/OpenGL/libdrm/include \
-I${SRCTOP}/Frameworks/OpenGL/libdrm/include/drm \
-I${.CURDIR}/../libxkbcommon/include \
-I${MAKEOBJDIR}/include \
-I${SRCTOP}/Frameworks/OpenGL/mesa/include \
-I${SRCTOP}/Frameworks/OpenGL/mesa/src/gbm/main \
-DWLR_HAS_DRM_BACKEND -DWLR_HAS_LIBINPUT_BACKEND \
-DWLR_HAS_GLES2_RENDERER -DWLR_HAS_X11_BACKEND=0 \
-DWLR_HAS_VULKAN_RENDERER=0 -DWLR_HAS_XWAYLAND=0 \
4 changes: 3 additions & 1 deletion Frameworks/AppKit/Makefile
@@ -598,8 +598,10 @@ RESOURCES=Info.plist en.lproj de.lproj fr.lproj \
WindowServer.backend/fragShader.glsl

CFLAGS+= -I${.CURDIR}/.. -I${BUILDROOT}/usr/include -I/sys \
-I${.CURDIR}/../OpenGL/wayland/egl -I${.CURDIR}/../OpenGL/wayland/src \
-I../OpenGL/wayland/src \
-I${SRCTOP}/CoreServices/WindowServer/libxkbcommon/include \
-F../OpenGL -framework OpenGL -I${.CURDIR}/Headers -I../Foundation/Headers \
-I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include \
-I${.CURDIR} -I${MAKEOBJDIR} -I${.CURDIR}/../../CoreServices \
-D_BuildingFramework -DFREETYPE_PRESENT
LDFLAGS+= ${FMWK_LDFLAGS} \
116 changes: 58 additions & 58 deletions Frameworks/AppKit/WindowServer.backend/WLDisplay.m
@@ -45,7 +45,7 @@ of this software and associated documentation files (the "Software"), to deal
#import <fontconfig.h>
#import <dev/evdev/input-event-codes.h>
#import <xkbcommon/xkbcommon.h>
#import <X11/keysym.h>
#import <xkbcommon/xkbcommon-keysyms.h>

const NSString *WLOutputNameKey = @"WLOutputName";
const NSString *WLOutputDescriptionKey = @"WLOutputDescription";
@@ -263,63 +263,63 @@ - (struct xkb_state *)xkb_state
static unichar translateKeySym(xkb_keysym_t keysym)
{
switch(keysym) {
case XK_Home:
case XK_KP_Home: return NSHomeFunctionKey;
case XK_Left:
case XK_KP_Left: return NSLeftArrowFunctionKey;
case XK_Up:
case XK_KP_Up: return NSUpArrowFunctionKey;
case XK_Right:
case XK_KP_Right: return NSRightArrowFunctionKey;
case XK_Down:
case XK_KP_Down: return NSDownArrowFunctionKey;
case XK_Page_Up:
case XK_KP_Page_Up: return NSPageUpFunctionKey;
case XK_Page_Down:
case XK_KP_Page_Down: return NSPageDownFunctionKey;
case XK_End:
case XK_KP_End: return NSEndFunctionKey;
case XK_Begin:
case XK_KP_Begin: return NSHomeFunctionKey;
case XK_Delete:
case XK_KP_Delete: return NSDeleteFunctionKey;
case XK_Insert:
case XK_KP_Insert: return NSInsertFunctionKey;
case XK_F1: return NSF1FunctionKey;
case XK_F2: return NSF2FunctionKey;
case XK_F3: return NSF3FunctionKey;
case XK_F4: return NSF4FunctionKey;
case XK_F5: return NSF5FunctionKey;
case XK_F6: return NSF6FunctionKey;
case XK_F7: return NSF7FunctionKey;
case XK_F8: return NSF8FunctionKey;
case XK_F9: return NSF9FunctionKey;
case XK_F10: return NSF10FunctionKey;
case XK_F11: return NSF11FunctionKey;
case XK_F12: return NSF12FunctionKey;
case XK_F13: return NSF13FunctionKey;
case XK_F14: return NSF14FunctionKey;
case XK_F15: return NSF15FunctionKey;
case XK_F16: return NSF16FunctionKey;
case XK_F17: return NSF17FunctionKey;
case XK_F18: return NSF18FunctionKey;
case XK_F19: return NSF19FunctionKey;
case XK_F20: return NSF20FunctionKey;
case XK_F21: return NSF21FunctionKey;
case XK_F22: return NSF22FunctionKey;
case XK_F23: return NSF23FunctionKey;
case XK_F24: return NSF24FunctionKey;
case XK_F25: return NSF25FunctionKey;
case XK_F26: return NSF26FunctionKey;
case XK_F27: return NSF27FunctionKey;
case XK_F28: return NSF28FunctionKey;
case XK_F29: return NSF29FunctionKey;
case XK_F30: return NSF30FunctionKey;
case XK_F31: return NSF31FunctionKey;
case XK_F32: return NSF32FunctionKey;
case XK_F33: return NSF33FunctionKey;
case XK_F34: return NSF34FunctionKey;
case XK_F35: return NSF35FunctionKey;
case XKB_KEY_Home:
case XKB_KEY_KP_Home: return NSHomeFunctionKey;
case XKB_KEY_Left:
case XKB_KEY_KP_Left: return NSLeftArrowFunctionKey;
case XKB_KEY_Up:
case XKB_KEY_KP_Up: return NSUpArrowFunctionKey;
case XKB_KEY_Right:
case XKB_KEY_KP_Right: return NSRightArrowFunctionKey;
case XKB_KEY_Down:
case XKB_KEY_KP_Down: return NSDownArrowFunctionKey;
case XKB_KEY_Page_Up:
case XKB_KEY_KP_Page_Up: return NSPageUpFunctionKey;
case XKB_KEY_Page_Down:
case XKB_KEY_KP_Page_Down: return NSPageDownFunctionKey;
case XKB_KEY_End:
case XKB_KEY_KP_End: return NSEndFunctionKey;
case XKB_KEY_Begin:
case XKB_KEY_KP_Begin: return NSHomeFunctionKey;
case XKB_KEY_Delete:
case XKB_KEY_KP_Delete: return NSDeleteFunctionKey;
case XKB_KEY_Insert:
case XKB_KEY_KP_Insert: return NSInsertFunctionKey;
case XKB_KEY_F1: return NSF1FunctionKey;
case XKB_KEY_F2: return NSF2FunctionKey;
case XKB_KEY_F3: return NSF3FunctionKey;
case XKB_KEY_F4: return NSF4FunctionKey;
case XKB_KEY_F5: return NSF5FunctionKey;
case XKB_KEY_F6: return NSF6FunctionKey;
case XKB_KEY_F7: return NSF7FunctionKey;
case XKB_KEY_F8: return NSF8FunctionKey;
case XKB_KEY_F9: return NSF9FunctionKey;
case XKB_KEY_F10: return NSF10FunctionKey;
case XKB_KEY_F11: return NSF11FunctionKey;
case XKB_KEY_F12: return NSF12FunctionKey;
case XKB_KEY_F13: return NSF13FunctionKey;
case XKB_KEY_F14: return NSF14FunctionKey;
case XKB_KEY_F15: return NSF15FunctionKey;
case XKB_KEY_F16: return NSF16FunctionKey;
case XKB_KEY_F17: return NSF17FunctionKey;
case XKB_KEY_F18: return NSF18FunctionKey;
case XKB_KEY_F19: return NSF19FunctionKey;
case XKB_KEY_F20: return NSF20FunctionKey;
case XKB_KEY_F21: return NSF21FunctionKey;
case XKB_KEY_F22: return NSF22FunctionKey;
case XKB_KEY_F23: return NSF23FunctionKey;
case XKB_KEY_F24: return NSF24FunctionKey;
case XKB_KEY_F25: return NSF25FunctionKey;
case XKB_KEY_F26: return NSF26FunctionKey;
case XKB_KEY_F27: return NSF27FunctionKey;
case XKB_KEY_F28: return NSF28FunctionKey;
case XKB_KEY_F29: return NSF29FunctionKey;
case XKB_KEY_F30: return NSF30FunctionKey;
case XKB_KEY_F31: return NSF31FunctionKey;
case XKB_KEY_F32: return NSF32FunctionKey;
case XKB_KEY_F33: return NSF33FunctionKey;
case XKB_KEY_F34: return NSF34FunctionKey;
case XKB_KEY_F35: return NSF35FunctionKey;
default: return keysym;
}
}
4 changes: 2 additions & 2 deletions Frameworks/Cocoa/Makefile
@@ -5,8 +5,8 @@ SRCS=Cocoa.m
INCS=Cocoa.h

RESOURCES=Info.plist
CFLAGS+= ${FMWK_CFLAGS} -I.. -I../Foundation/Headers -I../AppKit/Headers -F../OpenGL \
-framework OpenGL -I../libobjc2
CFLAGS+= ${FMWK_CFLAGS} -I.. -I../Foundation/Headers -I${.CURDIR}/../AppKit/Headers -F../OpenGL \
-framework OpenGL -I../libobjc2 -I${.CURDIR}/..
LDFLAGS+= -L../AppKit -L../Foundation -L../CoreFoundation \
-lAppKit -lFoundation -lCoreFoundation -lobjc -lmach \
-Wl,-R/System/Library/Frameworks/AppKit.framework/Versions/A \
2 changes: 1 addition & 1 deletion Frameworks/CoreData/Makefile
@@ -53,7 +53,7 @@ NSRelationshipDescription.h \
NSXMLPersistentStore.h

RESOURCES=Info.plist English.lproj
CFLAGS+= ${FMWK_CFLAGS} -I.. -I../libobjc2 -I../Foundation/Headers
CFLAGS+= ${FMWK_CFLAGS} -I${.CURDIR}/.. -I.. -I../libobjc2 -I../Foundation/Headers

_install-hook:
rm -rf ${BUILDROOT}/System/Library/Frameworks/${FRAMEWORK}.framework
3 changes: 2 additions & 1 deletion Frameworks/CoreGraphics/Makefile
@@ -64,7 +64,8 @@ INCS= \
CoreText.h

RESOURCES=Info.plist
CFLAGS+= ${FMWK_CFLAGS} -F../OpenGL -framework OpenGL -I.. -I../Foundation/Headers
CFLAGS+= ${FMWK_CFLAGS} -F../OpenGL -framework OpenGL -I.. -I${.CURDIR}/.. \
-I../Foundation/Headers -I../OpenGL -I${.CURDIR}/../OpenGL/mesa/include
LDFLAGS+= ${FMWK_LDFLAGS} -L${BUILDROOT}/System/Library/Frameworks/Onyx2D.framework \
-L${BUILDROOT}/System/Library/Frameworks/OpenGL.framework -lOnyx2D -lOpenGL -lm \
-Wl,-R/System/Library/Frameworks/Onyx2D.framework/Versions/A \
2 changes: 1 addition & 1 deletion Frameworks/CoreText/Makefile
@@ -4,7 +4,7 @@ FRAMEWORK=CoreText
SRCS= CTFont.m KTFont.m
INCS= CoreText.h CoreTextExport.h CTFont.h KTFont.h
RESOURCES=Info.plist
CFLAGS+= ${FMWK_CFLAGS} -I.. -I../libobjc2 -I../Foundation/Headers
CFLAGS+= ${FMWK_CFLAGS} -I.. -I../libobjc2 -I../Foundation/Headers -I${.CURDIR}/..

_install-hook:
rm -rf ${BUILDROOT}/System/Library/Frameworks/${FRAMEWORK}.framework
4 changes: 3 additions & 1 deletion Frameworks/LaunchServices/LaunchServices.mm
@@ -49,7 +49,7 @@
#define _XOPEN_SOURCE 500
#endif

#include <X11/Xlib.h>
//#include <X11/Xlib.h>

#define _NET_WM_STATE_REMOVE 0
#define _NET_WM_STATE_ADD 1
@@ -405,6 +405,7 @@ static BOOL _LSAddRecordToDatabase(const LSAppRecord *appRecord, BOOL isUpdate)
return true;
}

#ifdef _X11_
static void PostXEvent(Display *display, Window window, Atom messageType, long d0, long d1,
long d2, long d3, long d4)
{
@@ -425,6 +426,7 @@ static void PostXEvent(Display *display, Window window, Atom messageType, long d
XGetWindowAttributes(display, window, &attr);
XSendEvent(display, attr.screen->root, False, SubstructureNotifyMask | SubstructureRedirectMask, &e);
}
#endif // _X11_

void LSRevealInFiler(CFArrayRef inItemURLs)
{
2 changes: 1 addition & 1 deletion Frameworks/Onyx2D/Makefile
@@ -192,7 +192,7 @@ INCS= \
gif_lib.h

RESOURCES=Info.plist English.lproj
CFLAGS+= ${FMWK_CFLAGS} -I${.CURDIR} -I.. -I../libobjc2 -I../Foundation/Headers
CFLAGS+= ${FMWK_CFLAGS} -I${.CURDIR} -I${.CURDIR}/.. -I.. -I../libobjc2 -I../Foundation/Headers
LDFLAGS+= ${FMWK_LDFLAGS} -ljpeg -lpng -ltiff

_install-hook:
3 changes: 2 additions & 1 deletion Frameworks/framework.common.mk
@@ -1,5 +1,6 @@
# Common settings for building frameworks
FMWK_CFLAGS := -O0 -g -D__RAVYNOS__ -DPLATFORM_IS_POSIX -DGCC_RUNTIME_3 \
FMWK_CFLAGS := --sysroot=${OBJTOP}/tmp -B${OBJTOP}/tmp/usr/bin \
-O0 -g -D__RAVYNOS__ -DPLATFORM_IS_POSIX -DGCC_RUNTIME_3 \
-DPLATFORM_USES_BSD_SOCKETS -I/usr/include/freetype2 \
-I/usr/include/fontconfig -fobjc-runtime=gnustep-2.0 \
-fobjc-nonfragile-abi -fPIC -Wno-missing-method-return-type -Wno-macro-redefined

0 comments on commit 9628cf4

Please sign in to comment.