less flickering
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good

This commit is contained in:
Nishi 2026-04-29 04:24:01 +09:00
commit c095fb97a8
8 changed files with 125 additions and 96 deletions

View file

@ -14,6 +14,9 @@ AllowShortIfStatementsOnASingleLine: Always
AllowShortBlocksOnASingleLine: Never
AllowShortFunctionsOnASingleLine: Empty
AllowShortLoopsOnASingleLine: true
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: true
SpaceBeforeParens: Never
AlignEscapedNewlines: DontAlign
SortIncludes: false

2
configure vendored
View file

@ -227,7 +227,7 @@ print(OUT " cp -rf include \$(DESTDIR)\$(PREFIX)/\n");
print(OUT "\n");
print(OUT "format:\n");
print(OUT
" clang-format --verbose -i `find tools src include examples \"(\" -name \"*.c\" -or -name \"*.cxx\" -or -name \"*.h\" -or -name \"*.m\" \")\" -and -not -name \"*ttf.c\"`\n"
" clang-format --verbose -i `find tools src include examples \"(\" -name \"*.c\" -or -name \"*.cc\" -or -name \"*.h\" -or -name \"*.m\" \")\" -and -not -name \"*ttf.c\"`\n"
);
print(OUT
" perltidy -b -bext=\"/\" --paren-tightness=2 `find tools pl configure -name \"*.pl\"`\n"

View file

@ -34,6 +34,7 @@ class MwView : public BView {
MwLL handle;
BLocker* locker;
uint32 buttons;
BBitmap* bitmap;
MwView(MwLL handle, BRect rc, uint32 resizingMode, uint32 flags);
~MwView();

View file

@ -69,6 +69,7 @@
#include <Screen.h>
#include <Application.h>
#include <Locker.h>
#include <Picture.h>
#include <Bitmap.h>
#endif
#include <OS.h>

View file

@ -130,13 +130,15 @@ static void MwLLNextEventImpl(MwLL handle) {
GetNextEvent(everyEvent, &event);
switch(event.what) {
case updateEvt: {
case updateEvt:
{
}
// MwLLDispatch(handle, draw, NULL);
break;
case osEvt:
break;
case mouseUp: {
case mouseUp:
{
// MwLLMouse m;
// m.button = MwLLMouseLeft;
// if(___curWindow->mouseButtonCallback != NULL) {
@ -151,7 +153,8 @@ static void MwLLNextEventImpl(MwLL handle) {
// }
// }
}
case mouseDown: {
case mouseDown:
{
// // start with callback stuff
// if(___curWindow->mouseButtonCallback != NULL) {
// int mods = MacModifiersToGLFWModifiers(event.modifiers);
@ -174,7 +177,8 @@ static void MwLLNextEventImpl(MwLL handle) {
// event.where.v);
// }
break;
case inGrow: {
case inGrow:
{
long growResult =
GrowWindow(handle->cmacos.window, event.where, &qd.screenBits.bounds);
@ -201,7 +205,8 @@ static void MwLLNextEventImpl(MwLL handle) {
// }
} break;
case inGoAway: {
case inGoAway:
{
if(TrackGoAway(handle->cmacos.window, event.where)) {
MwLLDispatch(handle, close, NULL);
// if(___curWindow->windowCloseCallback != NULL) {
@ -214,7 +219,8 @@ static void MwLLNextEventImpl(MwLL handle) {
}
case autoKey:
case keyDown:
case keyUp: {
case keyUp:
{
// // key char stuff
// unsigned char ch = (event.message & charCodeMask);
// if(*___curWindow->charCallback != NULL) {

View file

@ -128,7 +128,8 @@ static void recursive_dispatch_key_released(MwLL handle, int* k) {
for(i = 0; i < arrlen(self->commands); i++) {
draw_command cmd = self->commands[i];
switch(cmd.type) {
case COCOA_DRAW_COMMAND_POLY: {
case COCOA_DRAW_COMMAND_POLY:
{
int n;
NSBezierPath* path = [NSBezierPath bezierPath];
@ -156,7 +157,8 @@ static void recursive_dispatch_key_released(MwLL handle, int* k) {
free(cmd.poly.points);
} break;
case COCOA_DRAW_COMMAND_LINES: {
case COCOA_DRAW_COMMAND_LINES:
{
int n;
NSBezierPath* path = [NSBezierPath bezierPath];
@ -184,7 +186,8 @@ static void recursive_dispatch_key_released(MwLL handle, int* k) {
free(cmd.lines.points);
} break;
case COCOA_DRAW_COMMAND_PIXMAP: {
case COCOA_DRAW_COMMAND_PIXMAP:
{
NSRect rect = localRectFlip(NSMakeRect(cmd.pixmap.rect.x, cmd.pixmap.rect.y, cmd.pixmap.rect.width, cmd.pixmap.rect.height), self);
rect.origin.x += [self bounds].origin.x;
rect.origin.y += [self bounds].origin.y;

View file

@ -32,11 +32,13 @@ MwApplication::~MwApplication() {
void MwApplication::MessageReceived(BMessage* message) {
switch(message->what) {
case BAPP_MW_DESTROY: {
case BAPP_MW_DESTROY:
{
this->Quit();
break;
}
default: {
default:
{
BLooper::MessageReceived(message);
break;
}
@ -51,7 +53,7 @@ MwView::MwView(MwLL handle, BRect frame, uint32 resizingMode, uint32 flags) : BV
this->SetDrawingMode(B_OP_OVER);
this->SetLineMode(B_BUTT_CAP, B_BUTT_JOIN);
this->SetViewColor(255, 0, 0);
this->SetViewColor(B_TRANSPARENT_COLOR);
this->buttons = 0;
}
@ -73,7 +75,8 @@ void MwView::MessageReceived(BMessage* message) {
this->RemoveSelf();
break;
}
case BVIEW_MW_RESIZE: {
case BVIEW_MW_RESIZE:
{
int width, height;
if(message->FindInt32("view-width", &width) != B_OK) break;
@ -86,7 +89,8 @@ void MwView::MessageReceived(BMessage* message) {
}
break;
}
case BVIEW_MW_MOVE: {
case BVIEW_MW_MOVE:
{
int x, y;
if(message->FindInt32("view-x", &x) != B_OK) break;
@ -168,7 +172,8 @@ void MwView::MessageReceived(BMessage* message) {
this->Invalidate();
break;
}
default: {
default:
{
BView::MessageReceived(message);
break;
}
@ -299,7 +304,8 @@ void MwWindow::MessageReceived(BMessage* message) {
}
switch(message->what) {
case BWIN_MW_SET_TITLE: {
case BWIN_MW_SET_TITLE:
{
const char* title;
if(message->FindString("window-title", &title) != B_OK) break;
@ -307,7 +313,8 @@ void MwWindow::MessageReceived(BMessage* message) {
this->SetTitle(title);
break;
}
default: {
default:
{
BWindow::MessageReceived(message);
break;
}
@ -427,9 +434,11 @@ void MwLLLineImpl(MwLL handle, MwPoint* points, MwLLColor color) {
handle->haiku.view->PostMessage(&msg);
}
void MwLLBeginDrawImpl(MwLL handle) {}
void MwLLBeginDrawImpl(MwLL handle) {
}
void MwLLEndDrawImpl(MwLL handle) {}
void MwLLEndDrawImpl(MwLL handle) {
}
MwLLColor MwLLAllocColorImpl(MwLL handle, int r, int g, int b) {
MwLLColor c = (MwLLColor)malloc(sizeof(*c));

View file

@ -75,27 +75,33 @@ MwWidget MwMessageBox(MwWidget handle, const char* text, const char* title, unsi
icon = MwCreateWidget(MwImageClass, "image", window, 8, (h - 48) / 2, 48, 48);
switch(flag & MwMB_ICONMASK) {
case MwMB_ICONWARNING: {
case MwMB_ICONWARNING:
{
data = MwIconWarning;
break;
}
case MwMB_ICONINFO: {
case MwMB_ICONINFO:
{
data = MwIconInfo;
break;
}
case MwMB_ICONNOTE: {
case MwMB_ICONNOTE:
{
data = MwIconNote;
break;
}
case MwMB_ICONNEWS: {
case MwMB_ICONNEWS:
{
data = MwIconNews;
break;
}
case MwMB_ICONERROR: {
case MwMB_ICONERROR:
{
data = MwIconError;
break;
}
case MwMB_ICONCLOCK: {
case MwMB_ICONCLOCK:
{
data = MwIconClock;
break;
}