fix cursor thing for x11/gdi, also format
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good

This commit is contained in:
Nishi 2026-03-24 04:26:26 +09:00
commit 6d7fe3271f
Signed by: nishi
GPG key ID: 27EF69B208EB9343
8 changed files with 231 additions and 228 deletions

View file

@ -23,9 +23,9 @@
// Note: implements NSApplicationDelegate
@interface MilskoCocoaApplicationDelegate : NSObject {
NSApplication *appl;
NSApplication* appl;
}
- (MilskoCocoaApplicationDelegate *)initWithAppl:(NSApplication *)appl;
- (MilskoCocoaApplicationDelegate*)initWithAppl:(NSApplication*)appl;
@end
@interface MilskoCocoaWindow : NSWindow {
@ -34,9 +34,9 @@
// Note: implements NSWindowDelegate
@interface MilskoCocoaWindowDelegate : NSObject {
MilskoCocoaWindow *w;
MilskoCocoaWindow* w;
}
- (MilskoCocoaWindowDelegate *)initWithWin:(MilskoCocoaWindow *)win;
- (MilskoCocoaWindowDelegate*)initWithWin:(MilskoCocoaWindow*)win;
@end
/*
@ -52,139 +52,138 @@
retrieved appropriately.
*/
@interface MilskoFakePointer : NSView {
void *ptr;
void* ptr;
}
- (void)setPointer:(void *)ptr;
- (void *)pointer;
- (void)setPointer:(void*)ptr;
- (void*)pointer;
@end
@interface MilskoCocoaPixmap : NSObject {
MwBool valid;
int width;
int height;
unsigned char *buf;
NSImage *image;
NSBitmapImageRep *rep;
MwBool valid;
int width;
int height;
unsigned char* buf;
NSImage* image;
NSBitmapImageRep* rep;
}
+ (MilskoCocoaPixmap *)newWithWidth:(int)width height:(int)height;
- (void)updateWithData:(unsigned char *)data;
+ (MilskoCocoaPixmap*)newWithWidth:(int)width height:(int)height;
- (void)updateWithData:(unsigned char*)data;
- (void)destroy;
/* using @property to create instance variables fucks up 10.4 gcc for some
* reason? */
- (NSImage *)image;
- (NSImage*)image;
@end
@interface MilskoCocoaView : NSView {
NSBitmapImageRep *rep;
NSGraphicsContext *context;
MwBool valid;
CGColorSpaceRef space;
CGDataProviderRef provider;
float width;
float height;
NSBitmapImageRep* rep;
NSGraphicsContext* context;
MwBool valid;
CGColorSpaceRef space;
CGDataProviderRef provider;
float width;
float height;
}
- (void)initRepAndContextWithWidth:(float)w Height:(float)h;
- (NSGraphicsContext *)context;
- (NSGraphicsContext*)context;
- (void)destroy;
- (NSBitmapImageRep *)getRep;
- (NSBitmapImageRep*)getRep;
@end
@interface MilskoCocoa : NSObject {
NSApplication *application;
MwBool _forceRender;
MilskoCocoaWindow *window;
NSRect rect;
MilskoCocoaView *view;
MwLL parent;
MilskoFakePointer *handle;
unsigned int strHash;
NSEvent *lastEvent;
NSApplication* application;
MwBool _forceRender;
MilskoCocoaWindow* window;
NSRect rect;
MilskoCocoaView* view;
MwLL parent;
MilskoFakePointer* handle;
unsigned int strHash;
NSEvent* lastEvent;
MilskoCocoaPixmap *cursorPixmap;
NSCursor *cursor;
NSModalSession modalSession;
MwBool pointerLocked;
MwBool mouseMoved;
MilskoCocoaPixmap* cursorPixmap;
NSCursor* cursor;
NSModalSession modalSession;
MwBool pointerLocked;
MwBool mouseMoved;
}
+ (MilskoCocoa *)newWithParent:(MwLL)parent
x:(int)x
y:(int)y
width:(int)width
height:(int)height
handle:(MwLL)handle;
- (void)polygonWithPoints:(MwPoint *)points
points_count:(int)points_count
color:(MwLLColor)color;
- (void)lineWithPoints:(MwPoint *)points color:(MwLLColor)color;
- (void)getX:(int *)x Y:(int *)y W:(unsigned int *)w H:(unsigned int *)h;
+ (MilskoCocoa*)newWithParent:(MwLL)parent
x:(int)x
y:(int)y
width:(int)width
height:(int)height
handle:(MwLL)handle;
- (void)polygonWithPoints:(MwPoint*)points
points_count:(int)points_count
color:(MwLLColor)color;
- (void)lineWithPoints:(MwPoint*)points color:(MwLLColor)color;
- (void)getX:(int*)x Y:(int*)y W:(unsigned int*)w H:(unsigned int*)h;
- (void)setX:(int)x Y:(int)y;
- (void)setW:(int)w H:(int)h;
- (int)pending;
- (void)eventProcess:(NSEvent *)ev;
- (void)handleKeyEvent:(NSEvent *)ev ll:(MwLL)ll;
- (void)handleMouseEvent:(NSEvent *)ev ll:(MwLL)ll;
- (void)eventProcess:(NSEvent*)ev;
- (void)handleKeyEvent:(NSEvent*)ev ll:(MwLL)ll;
- (void)handleMouseEvent:(NSEvent*)ev ll:(MwLL)ll;
- (void)getNextEvent;
- (void)setTitle:(const char *)title;
- (void)drawPixmap:(MwLLPixmap)pixmap rect:(MwRect *)rect;
- (void)setTitle:(const char*)title;
- (void)drawPixmap:(MwLLPixmap)pixmap rect:(MwRect*)rect;
- (void)setIcon:(MwLLPixmap)pixmap;
- (void)forceRender;
- (void)setCursor:(MwCursor *)image mask:(MwCursor *)mask;
- (void)detachWithPoint:(MwPoint *)point;
- (void)setCursor:(MwCursor*)image mask:(MwCursor*)mask;
- (void)detachWithPoint:(MwPoint*)point;
- (void)show:(int)show;
- (void)makePopupWithParent:(MwLL)parent;
- (void)setSizeHintsWithMinX:(int)minx
MinY:(int)miny
MaxX:(int)maxx
MaxY:(int)maxy;
MinY:(int)miny
MaxX:(int)maxx
MaxY:(int)maxy;
- (void)makeBorderless:(int)toggle;
- (void)focus;
- (void)grabPointer:(int)toggle;
- (void)setClipboard:(const char *)text;
- (void)setClipboard:(const char*)text;
- (void)makeToolWindow;
- (void)getCursorCoord:(MwPoint *)point;
- (void)getScreenSize:(MwRect *)rect;
- (void)getCursorCoord:(MwPoint*)point;
- (void)getScreenSize:(MwRect*)rect;
- (void)destroy;
- (void)sendClipboardEvent;
- (MwLL)getParent;
- (NSView *)getView;
- (MilskoCocoaWindow *)getWindow;
- (NSView*)getView;
- (MilskoCocoaWindow*)getWindow;
- (MilskoFakePointer *)getHandle;
+ (void)eventCanceller:(MilskoCocoa *)this;
- (MilskoFakePointer*)getHandle;
+ (void)eventCanceller:(MilskoCocoa*)this;
@end
#define OBJC(x) x
#else
#define OBJC(x) void *
#define OBJC(x) void*
#endif
MWDECL int MwLLCocoaCallInit(void);
struct _MwLLCocoa {
struct _MwLLCommon common;
OBJC(MilskoCocoa *)
real;
struct _MwLLCommon common;
OBJC(MilskoCocoa*)
real;
};
struct _MwLLCocoaColor {
struct _MwLLCommonColor common;
struct _MwLLCommonColor common;
};
struct _MwLLCocoaPixmap {
struct _MwLLCommonPixmap common;
OBJC(MilskoCocoaPixmap *)
real;
struct _MwLLCommonPixmap common;
OBJC(MilskoCocoaPixmap*)
real;
};
#endif

View file

@ -43,7 +43,7 @@ MWDECL MwClass MwOpenGLClass;
* @param handle Widget
*/
MwInline void MwOpenGLMakeCurrent(MwWidget handle) {
MwVaWidgetExecute(handle, "mwOpenGLMakeCurrent", NULL);
MwVaWidgetExecute(handle, "mwOpenGLMakeCurrent", NULL);
}
/*!
@ -52,10 +52,10 @@ MwInline void MwOpenGLMakeCurrent(MwWidget handle) {
* @param name Name
* @return Procedure
*/
MwInline void *MwOpenGLGetProcAddress(MwWidget handle, const char *name) {
void *out;
MwVaWidgetExecute(handle, "mwOpenGLGetProcAddress", &out, name);
return out;
MwInline void* MwOpenGLGetProcAddress(MwWidget handle, const char* name) {
void* out;
MwVaWidgetExecute(handle, "mwOpenGLGetProcAddress", &out, name);
return out;
}
/*!
@ -63,7 +63,7 @@ MwInline void *MwOpenGLGetProcAddress(MwWidget handle, const char *name) {
* @param handle Widget
*/
MwInline void MwOpenGLSwapBuffer(MwWidget handle) {
MwVaWidgetExecute(handle, "mwOpenGLSwapBuffer", NULL);
MwVaWidgetExecute(handle, "mwOpenGLSwapBuffer", NULL);
}
#ifdef __cplusplus