8 Commits

Author SHA1 Message Date
IoIxD
bd47bdab41 Merge commit 'c6c202864' into wayland-p2 2025-12-17 19:12:48 -07:00
IoIxD
c6c2028646 merge conflict 2025-12-17 19:08:06 -07:00
NishiOwO
7f823e2d34 format 2025-12-15 12:22:01 +09:00
NishiOwO
7f43a974cd pixmap works 2025-12-15 12:21:14 +09:00
NishiOwO
bee6cb81ca now ACTUALLY format 2025-12-15 11:07:58 +09:00
NishiOwO
7a81af9922 some stuffs work 2025-12-15 11:05:20 +09:00
NishiOwO
4951e8995e remove egl dependency 2025-12-15 09:31:33 +09:00
IoIxD
f68b9a9aae remove egl stuff from wayland to make way for a software renderer lmao 2025-12-14 17:04:35 -07:00
52 changed files with 420 additions and 2660 deletions

2
.gitignore vendored
View File

@@ -5,12 +5,10 @@ examples/*/*.exe
!examples/*/
!examples/*.*
!examples/*/*.*
*.exe
*.o
*.so
*.dll
*.lib
*.a
/Makefile
/build
compile_flags.txt

View File

@@ -195,6 +195,7 @@ target_compile_definitions(
_MILSKO
)
include(GNUInstallDirs)
install(
TARGETS Mw
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}

View File

@@ -1,4 +1,4 @@
Copyright (c) 2025-2026, Pyrite development team
Copyright (c) 2025, Pyrite development team
All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@@ -226,7 +226,7 @@ foreach my $l (@library_targets) {
}
print(OUT "${l}: ${s}\n");
print(OUT " \$(CC) $warn \$\(INCDIR) \$(CFLAGS\) -c -o ${l} ${s}\n");
print(OUT " \$(CC) $warn \$(CFLAGS\) \$\(INCDIR) -c -o ${l} ${s}\n");
}
print(OUT "\n");
print(OUT "\n");

View File

@@ -1,58 +0,0 @@
#include <Mw/Milsko.h>
MwWidget window, instructions, text;
void resize(MwWidget handle, void* user_data, void* call_data) {
unsigned int w, h, mh;
(void)user_data;
(void)call_data;
w = MwGetInteger(handle, MwNwidth);
h = MwGetInteger(handle, MwNheight);
MwVaApply(instructions,
MwNy, 50 + mh,
MwNwidth, w - 50 * 2,
MwNheight, h - 125 - 50 * 3,
NULL);
MwVaApply(text,
MwNy, 200 + mh,
MwNwidth, w - 50 * 2,
MwNheight, h - 125 - 50 * 3,
NULL);
}
void clipboard(MwWidget handle, void* user_data, void* call_data) {
char* clipboard = call_data;
(void)handle;
(void)user_data;
if(clipboard != NULL) {
MwVaApply(text, MwNtext, clipboard);
MwForceRender(text);
}
MwForceRender(window);
}
int main() {
MwLibraryInit();
window = MwVaCreateWidget(MwWindowClass, "main", NULL, MwDEFAULT, MwDEFAULT, 400, 400,
MwNtitle, "clipboard",
NULL);
instructions = MwVaCreateWidget(MwLabelClass, "button", window, 50, 50, 300, 125,
MwNtext, "clipboard contents will show up below.",
NULL);
text = MwVaCreateWidget(MwLabelClass, "label", window, 50, 200, 300, 125,
MwNtext, "",
NULL);
MwAddUserHandler(window, MwNresizeHandler, resize, NULL);
MwAddUserHandler(window, MwNclipboardHandler, clipboard, NULL);
resize(window, NULL, NULL);
MwLoop(window);
}

View File

@@ -1,23 +0,0 @@
#include <Mw/Milsko.h>
int main() {
MwWidget wnd, label;
int W = 480, H = 40;
MwLibraryInit();
wnd = MwVaCreateWidget(MwWindowClass, "main", NULL, MwDEFAULT, MwDEFAULT, W, H,
MwNtitle, "seven segment",
NULL);
label = MwVaCreateWidget(MwLabelClass, "label", wnd, 0, 0, W, H,
MwNtext, " 123456:78.90 abcdef",
MwNsevenSegment, 1,
MwNalignment, MwALIGNMENT_BEGINNING,
MwNlength, 8,
NULL);
MwLabelSetSevenSegment(label, 0, (1 << 0) | (1 << 3) | (1 << 6));
MwLoop(wnd);
}

View File

@@ -354,11 +354,6 @@ MWDECL void MwGetCursorCoord(MwWidget handle, MwPoint* point);
*/
MWDECL void MwGetScreenSize(MwWidget handle, MwRect* rect);
/*!
* @brief Reports whether a widget reports global or local coordinates upon GetXY/SetXY. Anything with a parent reports local, and most backends report global coordinates being supported for top level windows, but some (Wayland) do not.
*/
MWDECL int MwGetCoordinateType(MwWidget handle);
#ifdef __cplusplus
}
#endif

View File

@@ -52,11 +52,6 @@ MWDECL const char* MwDefaultDarkSubBackground;
*/
MWDECL const char* MwDefaultDarkSubForeground;
/*!
* @brief Default shadow difference
*/
MWDECL const int MwDefaultShadow;
/*!
* @brief Gets default border width
* @param handle Widget

View File

@@ -33,7 +33,6 @@ struct _MwLLCommon {
void* user;
int copy_buffer;
int type;
int coordinate_type;
MwLLHandler handler;
};
@@ -148,7 +147,6 @@ struct _MwLLHandler {
void (*key_released)(MwLL handle, void* data);
void (*focus_in)(MwLL handle, void* data);
void (*focus_out)(MwLL handle, void* data);
void (*clipboard)(MwLL handle, void* data);
};
#ifdef __cplusplus
@@ -205,7 +203,7 @@ MWDECL void (*MwLLFocus)(MwLL handle);
MWDECL void (*MwLLGrabPointer)(MwLL handle, int toggle);
MWDECL void (*MwLLSetClipboard)(MwLL handle, const char* text);
MWDECL void (*MwLLGetClipboard)(MwLL handle);
MWDECL char* (*MwLLGetClipboard)(MwLL handle);
MWDECL void (*MwLLGetCursorCoord)(MwLL handle, MwPoint* point);
MWDECL void (*MwLLGetScreenSize)(MwLL handle, MwRect* rect);

View File

@@ -21,7 +21,6 @@ struct _MwLLGDI {
int grabbed;
int force_render;
int get_clipboard;
};
struct _MwLLGDIColor {

View File

@@ -16,7 +16,6 @@
#include <wayland-client.h>
#include <xkbcommon/xkbcommon.h>
#include <cairo/cairo.h>
#include <pthread.h>
MWDECL int MwLLWaylandCallInit(void);
@@ -25,8 +24,6 @@ MWDECL int MwLLWaylandCallInit(void);
#include "Wayland/xdg-shell-client-protocol.h"
#include "Wayland/xdg-decoration-client-protocol.h"
#include "Wayland/cursor-shape-client-protocol.h"
#include "Wayland/primary-selection-client-protocol.h"
#include "Wayland/xdg-toplevel-icon-client-protocol.h"
#endif
struct _MwLLWayland;
@@ -37,12 +34,6 @@ typedef struct wayland_protocol {
} wayland_protocol_t;
typedef wayland_protocol_t*(wl_setup_func)(MwU32, struct _MwLLWayland*);
typedef void(wl_destroy_func)(struct _MwLLWayland* wayland, wayland_protocol_t* data);
typedef struct wayland_protocol_callback_table {
wl_setup_func* setup;
wl_destroy_func* destroy;
} wayland_protocol_callback_table_t;
struct _MwLLWaylandTopLevel {
struct xdg_surface* xdg_surface;
@@ -64,55 +55,9 @@ struct _MwLLWaylandSublevel {
struct wl_subcompositor* subcompositor;
MwLL parent;
struct xdg_surface* parent_xdg_surface;
MwLL topmost_parent; /* The parent at the top of all the other parents. Usually a toplevel. */
};
struct _MwLLWaylandPopup {
struct xdg_surface* xdg_surface;
struct xdg_popup* xdg_popup;
struct xdg_positioner* xdg_positioner;
struct xdg_surface_listener xdg_surface_listener;
struct xdg_wm_base* xdg_wm_base;
MwLL topmost_parent;
};
/* Shared set of anything needed for a shm buffer. */
struct _MwLLWaylandShmBuffer {
struct wl_shm* shm;
struct wl_shm_pool* shm_pool;
struct wl_buffer* shm_buffer;
struct wl_surface* surface;
struct wl_output* output;
MwU8* buf;
MwU64 buf_size;
int fd;
MwBool setup;
};
enum _MwLLWaylandType {
MWLL_WAYLAND_UNKNOWN = 0,
MWLL_WAYLAND_TOPLEVEL,
MWLL_WAYLAND_SUBLEVEL,
MWLL_WAYLAND_POPUP,
};
typedef struct wl_clipboard_device_context {
union {
struct wl_data_device* wl;
struct zwp_primary_selection_device_v1* zwp;
} device;
union {
struct wl_data_offer* wl;
struct zwp_primary_selection_offer_v1* zwp;
} offer;
MwLL ll;
struct wl_seat* seat;
MwU32 capabilities;
} wl_clipboard_device_context_t;
struct _MwLLWayland {
struct _MwLLCommon common;
@@ -121,17 +66,17 @@ struct _MwLLWayland {
struct _MwLLWaylandTopLevel* toplevel;
/* Pointer for data that's only loaded if the widget is a sublevel */
struct _MwLLWaylandSublevel* sublevel;
/* Pointer for data that's only loaded if the widget is a popup */
struct _MwLLWaylandPopup* popup;
};
enum _MwLLWaylandType type;
enum _MwLLWaylandType type_to_be;
enum {
MWLL_WAYLAND_TOPLEVEL = 0,
MWLL_WAYLAND_SUBLEVEL, /* Sublevels are surfaces that have the toplevel as a parent. Some parts of the code also call them subwidgets. */
} type;
/* Map of Wayland interfaces to their relevant setup functions. */
struct {
const char* key;
wayland_protocol_callback_table_t* value;
const char* key;
wl_setup_func* value;
}* wl_protocol_setup_map;
/* Map of Wayland interfaces to any information we keep about them once we've registered them. */
@@ -140,63 +85,25 @@ struct _MwLLWayland {
wayland_protocol_t* value;
}* wl_protocol_map;
MwBool always_render;
struct wl_display* display;
struct wl_registry* registry;
struct wl_compositor* compositor;
struct wl_surface* surface;
struct wl_registry_listener registry_listener;
struct wl_region* region;
struct wl_output* output;
/* clipboard related stuff.
* Note that unlike most interfaces, we don't keep zwp_primary_selection stuff in a wayland_protocol_t because we use wl_data_device as a fallback and want to have it share memory space.*/
union {
struct wl_data_device_manager* wl;
struct zwp_primary_selection_device_manager_v1* zwp;
} clipboard_manager;
union {
struct wl_data_source* wl;
struct zwp_primary_selection_source_v1* zwp;
} clipboard_source;
char* clipboard_buffer;
MwBool supports_zwp;
uint32_t clipboard_serial;
wl_clipboard_device_context_t** clipboard_devices;
struct wl_pointer* pointer;
MwU32 pointer_serial;
struct wl_keyboard* keyboard;
MwU32 keyboard_serial;
MwU64 events_pending;
MwU32 mod_state;
/*struct wl_event_queue* event_queue;*/
MwLL* sublevels; /* stb_ds managed array of any sublevels */
MwBool configured; /* Whether or not xdg_toplevel_configure has run once */
MwU32 x, y, ww, wh; /* Window position */
MwPoint cur_mouse_pos; /* Currently known mouse position */
MwU32 mw, mh; /* Monitor width and height as advertised by wl_output.mode */
MwLL parent;
MwBool force_render;
MwBool disabled;
struct _MwLLWaylandShmBuffer framebuffer;
struct _MwLLWaylandShmBuffer cursor;
struct _MwLLWaylandShmBuffer* icon;
/*
Events mutex. Any time a keyboard/mouse event happens, we try to lock this for 100 milliseconds, then give up if we can't do it. This is used in conjunction with some code in the MwLLDestroyImpl to make sure that destroy is NEVER interferes with an ongoing event.
IOI_XD: This sounds like a hilariously rare edge case, so it's almost funnier that this happened with 100% certainty for me and I spent day(s) trying to figure out what was happening. */
pthread_mutex_t eventsMutex;
struct wl_shm* shm;
struct wl_shm_pool* shm_pool;
struct wl_buffer* shm_buffer;
void* mapped_shm_buf;
MwU64 mapped_shm_buf_size;
int shm_fd;
cairo_surface_t* cs;
cairo_t* cairo;

View File

@@ -29,7 +29,6 @@ struct _MwLLX11 {
GC gc;
Colormap colormap;
Atom wm_delete;
Atom wm_protocols;
XIM xim;
XIC xic;

View File

@@ -35,10 +35,6 @@
#define MwNratio "Iratio"
#define MwNfixedSize "IfixedSize"
#define MwNmargin "Imargin"
#define MwNbitmapFont "IbitmapFont"
#define MwNsevenSegment "IsevenSegment"
#define MwNlength "Ilength"
#define MwNforceInverted "IforceInverted"
#define MwNtitle "Stitle"
#define MwNtext "Stext"
@@ -71,6 +67,5 @@
#define MwNdirectoryChosenHandler "CdirectoryChosen" /* char* */
#define MwNcolorChosenHandler "CcolorChosen" /* MwRGB* */
#define MwNdrawHandler "Cdraw" /* NULL */
#define MwNclipboardHandler "Cclipboard" /* char* */
#endif

View File

@@ -20,9 +20,6 @@ typedef struct _MwViewport* MwViewport;
typedef struct _MwListBox* MwListBox;
typedef struct _MwComboBox* MwComboBox;
typedef struct _MwTreeView* MwTreeView;
typedef struct _MwScrollBar* MwScrollBar;
typedef struct _MwLabel* MwLabel;
typedef struct _MwLabelSegment MwLabelSegment;
typedef struct _MwListBoxEntry MwListBoxEntry;
typedef struct _MwTreeViewEntry MwTreeViewEntry;
typedef struct _MwDirectoryEntry MwDirectoryEntry;
@@ -39,7 +36,6 @@ typedef void (*MwHandlerChildrenProp)(MwWidget handle, MwWidget child, const cha
typedef void (*MwHandlerKey)(MwWidget handle, int key);
typedef void (*MwHandlerMouse)(MwWidget handle, void* ptr);
typedef void (*MwHandlerExecute)(MwWidget handle, const char* name, void* out, va_list args);
typedef void (*MwHandlerClipboardReceived)(MwWidget handle, const char* data);
typedef void (*MwUserHandler)(MwWidget handle, void* user_data, void* call_data);
typedef void (*MwErrorHandler)(int code, const char* message, void* user_data);
@@ -109,7 +105,6 @@ struct _MwMenu {
int keep;
MwWidget wsub;
MwMenu* sub;
void* opaque;
};
struct _MwEntry {
@@ -169,21 +164,6 @@ struct _MwTreeView {
MwPoint pressed;
};
struct _MwScrollBar {
MwPoint point;
int drag;
int pos;
};
struct _MwLabel {
MwLabelSegment* segment;
};
struct _MwLabelSegment {
int key;
unsigned char value;
};
struct _MwDirectoryEntry {
char* name;
int type;
@@ -197,32 +177,26 @@ struct _MwListBoxPacket {
};
struct _MwClass {
MwHandlerWithStatus create;
MwHandler destroy;
MwHandler draw;
MwHandler click;
MwHandler parent_resize;
MwHandlerProp prop_change;
MwHandler mouse_move;
MwHandlerMouse mouse_up;
MwHandlerMouse mouse_down;
MwHandlerKey key;
MwHandlerExecute execute;
MwHandler tick;
MwHandler resize;
MwHandler children_update;
MwHandlerChildrenProp children_prop_change;
MwHandlerClipboardReceived clipboard;
void* reserved1;
void* reserved2;
void* reserved3;
void* reserved4;
};
/* Whether or not GetXY/SetXY works with global or local coordinates */
enum MwCoordinateType {
MwCoordinatesGlobal = 0,
MwCoordinatesLocal,
MwHandlerWithStatus create;
MwHandler destroy;
MwHandler draw;
MwHandler click;
MwHandler parent_resize;
MwHandlerProp prop_change;
MwHandler mouse_move;
MwHandlerMouse mouse_up;
MwHandlerMouse mouse_down;
MwHandlerKey key;
MwHandlerExecute execute;
MwHandler tick;
MwHandler resize;
MwHandler children_update;
MwHandlerChildrenProp children_prop_change;
void* reserved1;
void* reserved2;
void* reserved3;
void* reserved4;
void* reserved5;
};
#endif

View File

@@ -17,17 +17,6 @@ extern "C" {
*/
MWDECL MwClass MwLabelClass;
/*!
* @brief Sets the custom data for seven segment
* @param handle Widget
* @param index Index
* @param data Data, `GFEDCBA` as 7-bit value
* @note See https://en.wikipedia.org/wiki/File:7_Segment_Display_with_Labeled_Segments.svg for what alphabets mean here
* */
MwInline void MwLabelSetSevenSegment(MwWidget handle, int index, int data) {
MwVaWidgetExecute(handle, "mwLabelSetSevenSegment", NULL, index, data);
}
#ifdef __cplusplus
}
#endif

View File

@@ -9,7 +9,6 @@
#include <Mw/TypeDefs.h>
#include <Mw/Core.h>
#ifndef __gl_h_
#ifdef _WIN32
#include <windows.h>
#else
@@ -20,7 +19,6 @@
#ifndef GLAPIENTRY
#define GLAPIENTRY APIENTRY
#endif
#endif
#ifdef __cplusplus
extern "C" {

View File

@@ -18,25 +18,8 @@ extern "C" {
*/
MWDECL MwClass MwSubMenuClass;
/*!
* @brief Makes submenu appear
* @param handle Handle
* @param menu Menu
* @param point Point
* @param diff_calc Toggles different way to calculate positiion
*/
MwInline void MwSubMenuAppear(MwWidget handle, MwMenu menu, MwPoint* point, int diff_calc) {
MwVaWidgetExecute(handle, "mwSubMenuAppear", NULL, menu, point, diff_calc);
}
/*!
* @brief Calculates the size of submenu
* @param handle Handle
* @param menu Menu
* @param rect Size
*/
MwInline void MwSubMenuGetSize(MwWidget handle, MwMenu menu, MwRect* rect) {
MwVaWidgetExecute(handle, "mwSubMenuGetSize", NULL, menu, rect);
MwInline void MwSubMenuAppear(MwWidget handle, MwMenu menu, MwPoint* point) {
MwVaWidgetExecute(handle, "mwSubMenuAppear", NULL, menu, point);
}
#ifdef __cplusplus

View File

@@ -51,8 +51,6 @@
- MwNbackgroundPixmap
- MwNratio
- MwNfixedSize
- MwNbitmapFont
- MwNforceInverted
Integer properties must be prefixed with I.
String properties must be prefixed with S.
@@ -89,10 +87,6 @@
<integer name="ratio" />
<integer name="fixedSize" />
<integer name="margin" />
<integer name="bitmapFont" />
<integer name="sevenSegment" />
<integer name="length" />
<integer name="forceInverted" />
<string name="title" />
<string name="text" />
@@ -122,7 +116,6 @@
<handler name="directoryChosen" />
<handler name="colorChosen" />
<handler name="draw" />
<handler name="clipboard" />
</properties>
<enumerations>
<enumeration name="MwDIRECTION">
@@ -500,8 +493,6 @@
<property name="orientation" />
<property name="margin" />
<property name="padding" />
<property name="hasBorder" />
<property name="inverted" />
</properties>
</widget>
<widget name="Button">
@@ -535,7 +526,6 @@
<property name="pixmap" />
<property name="hasBorder" />
<property name="inverted" />
<property name="fillArea" />
</properties>
</widget>
<widget name="Label">
@@ -543,18 +533,7 @@
<property name="text" />
<property name="alignment" />
<property name="bold" />
<property name="sevenSegment" />
<property name="length" />
<property name="leftPadding" />
</properties>
<functions>
<function name="SetSevenSegment">
<arguments>
<integer name="index" />
<integer name="data" />
</arguments>
</function>
</functions>
</widget>
<widget name="ListBox">
<properties>
@@ -642,9 +621,6 @@
</functions>
</widget>
<widget name="SubMenu">
<properties>
<property name="leftPadding" />
</properties>
<functions>
<function name="Appear">
<arguments>

View File

@@ -2,6 +2,5 @@ add_incdir("-I/usr/X11R7/include -I/usr/pkg/include");
add_libdir(
"-L/usr/X11R7/lib -Wl,-R/usr/X11R7/lib -L/usr/pkg/lib -Wl,-R/usr/pkg/lib");
use_backend("x11");
add_libs("-lpthread");
1;

View File

@@ -32,18 +32,12 @@ if (grep(/^wayland$/, @backends)) {
add_cflags(`pkg-config --cflags cairo wayland-client xkbcommon`);
add_libs(`pkg-config --libs cairo wayland-client xkbcommon`);
if (param_get("opengl")) {
add_libs(`pkg-config --libs egl wayland-egl`);
}
scan_wayland_protocol("stable", "xdg-shell", "");
scan_wayland_protocol("stable", "tablet", "-v2");
scan_wayland_protocol("staging", "cursor-shape", "-v1");
scan_wayland_protocol("unstable", "xdg-decoration", "-unstable-v1");
scan_wayland_protocol("stable", "xdg-shell", "");
scan_wayland_protocol("stable", "tablet", "-v2");
scan_wayland_protocol("staging", "xdg-toplevel-icon", "-v1");
scan_wayland_protocol("staging", "cursor-shape", "-v1");
scan_wayland_protocol("unstable", "xdg-decoration", "-unstable-v1");
scan_wayland_protocol("unstable", "primary-selection", "-unstable-v1");
$gl_libs = "-lGL -lGLU";
$gl_libs = "-lEGL -lwayland-egl lGL -lGLU";
}
if (param_get("stb-image")) {
@@ -52,7 +46,6 @@ if (param_get("stb-image")) {
if (param_get("stb-truetype")) {
add_cflags("-DUSE_STB_TRUETYPE");
}
if (param_get("freetype2")) {
add_cflags("-DUSE_FREETYPE2");
if ($cross) {
@@ -119,8 +112,6 @@ new_example("examples/basic/colorpicker");
new_example("examples/basic/combobox");
new_example("examples/basic/treeview");
new_example("examples/basic/box");
new_example("examples/basic/clipboard");
new_example("examples/basic/sevensegment");
if (param_get("opengl")) {
new_example("examples/gldemos/boing", $gl_libs);

View File

@@ -237,13 +237,12 @@ static MwLL MwLLCreateImpl(MwLL parent, int x, int y, int width, int height) {
r->common.copy_buffer = 1;
r->common.type = MwLLBackendGDI;
r->gdi.get_clipboard = 1;
r->gdi.force_render = 0;
r->gdi.grabbed = 0;
r->gdi.hWnd = CreateWindow("milsko", "Milsko", parent == NULL ? (WS_OVERLAPPEDWINDOW) : (WS_CHILD | WS_VISIBLE), x == MwDEFAULT ? CW_USEDEFAULT : x, y == MwDEFAULT ? CW_USEDEFAULT : y, width, height, parent == NULL ? NULL : parent->gdi.hWnd, 0, wc.hInstance, NULL);
r->gdi.hInstance = wc.hInstance;
r->gdi.cursor = NULL;
r->gdi.icon = NULL;
r->gdi.force_render = 0;
r->gdi.grabbed = 0;
r->gdi.hWnd = CreateWindow("milsko", "Milsko", parent == NULL ? (WS_OVERLAPPEDWINDOW) : (WS_CHILD | WS_VISIBLE), x == MwDEFAULT ? CW_USEDEFAULT : x, y == MwDEFAULT ? CW_USEDEFAULT : y, width, height, parent == NULL ? NULL : parent->gdi.hWnd, 0, wc.hInstance, NULL);
r->gdi.hInstance = wc.hInstance;
r->gdi.cursor = NULL;
r->gdi.icon = NULL;
u->ll = r;
u->min_set = 0;
@@ -384,7 +383,6 @@ static int MwLLPendingImpl(MwLL handle) {
(void)handle;
if(handle->gdi.get_clipboard) return 1;
return PeekMessage(&msg, handle->gdi.hWnd, 0, 0, PM_NOREMOVE) ? 1 : 0;
}
@@ -393,24 +391,6 @@ static void MwLLNextEventImpl(MwLL handle) {
(void)handle;
if(handle->gdi.get_clipboard) {
HGLOBAL hg;
if(OpenClipboard(handle->gdi.hWnd) != 0 && (hg = GetClipboardData(CF_TEXT)) != NULL) {
char* txt = malloc(GlobalSize(hg));
char* clp = GlobalLock(hg);
strcpy(txt, clp);
GlobalUnlock(hg);
CloseClipboard();
MwLLDispatch(handle, clipboard, txt);
free(txt);
}
handle->gdi.get_clipboard = 0;
}
while(PeekMessage(&msg, handle->gdi.hWnd, 0, 0, PM_NOREMOVE)) {
GetMessage(&msg, handle->gdi.hWnd, 0, 0);
TranslateMessage(&msg);
@@ -717,8 +697,21 @@ static void MwLLSetClipboardImpl(MwLL handle, const char* text) {
}
}
static void MwLLGetClipboardImpl(MwLL handle) {
handle->gdi.get_clipboard = 1; /* nishi: we do this to make clipboard api work similar to other backends */
static char* MwLLGetClipboardImpl(MwLL handle) {
HGLOBAL hg;
char* r = NULL;
if(OpenClipboard(handle->gdi.hWnd) != 0 && (hg = GetClipboardData(CF_TEXT)) != NULL) {
char* lock;
r = malloc(GlobalSize(hg));
lock = GlobalLock(hg);
strcpy(r, lock);
GlobalUnlock(hg);
CloseClipboard();
}
return r;
}
static void MwLLMakeToolWindowImpl(MwLL handle) {

File diff suppressed because it is too large Load Diff

View File

@@ -159,7 +159,6 @@ static MwLL MwLLCreateImpl(MwLL parent, int x, int y, int width, int height) {
r->x11.toplevel = 0;
}
r->x11.window = XCreateSimpleWindow(r->x11.display, p, px, py, width, height, 0, 0, WhitePixel(r->x11.display, DefaultScreen(r->x11.display)));
sh.flags = PWinGravity;
sh.win_gravity = StaticGravity;
XSetWMNormalHints(r->x11.display, r->x11.window, &sh);
@@ -210,9 +209,8 @@ static MwLL MwLLCreateImpl(MwLL parent, int x, int y, int width, int height) {
r->x11.grabbed = 0;
r->x11.force_render = 0;
r->x11.colormap = DefaultColormap(r->x11.display, XDefaultScreen(r->x11.display));
r->x11.wm_delete = XInternAtom(r->x11.display, "WM_DELETE_WINDOW", False);
r->x11.wm_protocols = XInternAtom(r->x11.display, "WM_PROTOCOLS", False);
r->x11.colormap = DefaultColormap(r->x11.display, XDefaultScreen(r->x11.display));
r->x11.wm_delete = XInternAtom(r->x11.display, "WM_DELETE_WINDOW", False);
XSetWMProtocols(r->x11.display, r->x11.window, &r->x11.wm_delete, 1);
r->x11.gc = XCreateGC(r->x11.display, r->x11.window, 0, NULL);
@@ -413,7 +411,6 @@ static void MwLLFreeColorImpl(MwLLColor color) {
static int MwLLPendingImpl(MwLL handle) {
XEvent ev;
if(XCheckTypedWindowEvent(handle->x11.display, handle->x11.window, ClientMessage, &ev) || XCheckWindowEvent(handle->x11.display, handle->x11.window, mask, &ev)) {
XPutBackEvent(handle->x11.display, &ev);
return 1;
@@ -423,7 +420,6 @@ static int MwLLPendingImpl(MwLL handle) {
static void MwLLNextEventImpl(MwLL handle) {
XEvent ev;
while(XCheckTypedWindowEvent(handle->x11.display, handle->x11.window, ClientMessage, &ev) || XCheckWindowEvent(handle->x11.display, handle->x11.window, mask, &ev)) {
int render = 0;
if(ev.type == Expose) {
@@ -475,7 +471,7 @@ static void MwLLNextEventImpl(MwLL handle) {
handle->x11.width = ev.xconfigure.width;
handle->x11.height = ev.xconfigure.height;
} else if(ev.type == ClientMessage) {
if(ev.xclient.message_type == handle->x11.wm_protocols && ev.xclient.data.l[0] == (long)handle->x11.wm_delete) {
if(ev.xclient.data.l[0] == (long)handle->x11.wm_delete) {
MwLLDispatch(handle, close, NULL);
}
} else if(ev.type == FocusIn) {
@@ -960,10 +956,45 @@ static void MwLLSetClipboardImpl(MwLL handle, const char* text) {
(void)text;
}
static void MwLLGetClipboardImpl(MwLL handle) {
/* TODO */
static char* MwLLGetClipboardImpl(MwLL handle) {
Atom clip, target, prop;
XEvent ev;
XEvent* queue = NULL;
char* r = NULL;
(void)handle;
clip = XInternAtom(handle->x11.display, "CLIPBOARD", 0);
target = XA_STRING;
prop = XInternAtom(handle->x11.display, "XSEL_DATA", 0);
XConvertSelection(handle->x11.display, clip, target, prop, handle->x11.window, CurrentTime);
while(1) {
XNextEvent(handle->x11.display, &ev);
if(ev.type == SelectionNotify) {
if(ev.xselection.selection == clip && ev.xselection.property != 0) {
Atom t;
unsigned long size, N;
char* data;
int format;
XGetWindowProperty(ev.xselection.display, ev.xselection.requestor, ev.xselection.property, 0, (~0L), 0, AnyPropertyType, &t, &format, &size, &N, (unsigned char**)&data);
if(t == target) {
r = MwStringDuplicate(data);
XFree(data);
}
XDeleteProperty(ev.xselection.display, ev.xselection.requestor, ev.xselection.property);
}
break;
}
}
while(arrlen(queue) > 0) {
XPutBackEvent(handle->x11.display, &queue[0]);
arrdel(queue, 0);
}
arrfree(queue);
return r;
}
static void MwLLMakeToolWindowImpl(MwLL handle) {

View File

@@ -107,13 +107,6 @@ static void llfocusouthandler(MwLL handle, void* data) {
MwDispatchUserHandler(h, MwNfocusOutHandler, data);
}
static void llclipboardhandler(MwLL handle, void* data) {
MwWidget h = (MwWidget)handle->common.user;
MwDispatch3(h, clipboard, data);
MwDispatchUserHandler(h, MwNclipboardHandler, data);
}
MwWidget MwCreateWidget(MwClass widget_class, const char* name, MwWidget parent, int x, int y, unsigned int width, unsigned int height) {
MwWidget h = malloc(sizeof(*h));
@@ -121,7 +114,6 @@ MwWidget MwCreateWidget(MwClass widget_class, const char* name, MwWidget parent,
h->parent = parent;
h->children = NULL;
if(widget_class != NULL) {
if((h->lowlevel = MwLLCreate(parent == NULL ? NULL : parent->lowlevel, x, y, width, height)) == NULL) {
free(h->name);
@@ -156,7 +148,6 @@ MwWidget MwCreateWidget(MwClass widget_class, const char* name, MwWidget parent,
h->lowlevel->common.handler->key_released = llkeyrelhandler;
h->lowlevel->common.handler->focus_in = llfocusinhandler;
h->lowlevel->common.handler->focus_out = llfocusouthandler;
h->lowlevel->common.handler->clipboard = llclipboardhandler;
}
if(parent != NULL) arrput(parent->children, h);
@@ -270,8 +261,6 @@ void MwDestroyWidget(MwWidget handle) {
if(i == arrlen(handle->parent->destroy_queue)) {
arrput(handle->parent->destroy_queue, handle);
}
MwDispatch(handle->parent, children_update);
}
destroy_children(handle);
handle->destroyed = 1;
@@ -396,9 +385,6 @@ void MwSetInteger(MwWidget handle, const char* key, int n) {
MwDispatch3(handle, prop_change, key);
if(handle->parent != NULL) MwDispatch4(handle->parent, children_prop_change, handle, key);
}
if(strcmp(key, MwNforceInverted) == 0) {
MwForceRender(handle);
}
}
void MwSetText(MwWidget handle, const char* key, const char* value) {
@@ -442,15 +428,6 @@ void MwSetVoid(MwWidget handle, const char* key, void* value) {
}
}
static int inherit_integer(MwWidget handle, const char* key, int default_v) {
int v;
if(handle->parent != NULL && (v = MwGetInteger(handle->parent, key)) != MwDEFAULT) {
return v;
}
return default_v;
}
int MwGetInteger(MwWidget handle, const char* key) {
if(strcmp(key, MwNx) == 0 || strcmp(key, MwNy) == 0 || strcmp(key, MwNwidth) == 0 || strcmp(key, MwNheight) == 0) {
int x, y;
@@ -464,18 +441,6 @@ int MwGetInteger(MwWidget handle, const char* key) {
if(strcmp(key, MwNheight) == 0) return h;
return MwDEFAULT;
} else {
if(shgeti(handle->integer, key) == -1) {
#if defined(USE_STB_TRUETYPE) || defined(USE_FREETYPE2)
if(strcmp(key, MwNbitmapFont) == 0) return inherit_integer(handle, key, 0);
#else
if(strcmp(key, MwNbitmapFont) == 0) return inherit_integer(handle, key, 1);
#endif
#ifdef USE_CLASSIC_THEME
if(strcmp(key, MwNmodernLook) == 0) return inherit_integer(handle, key, 0);
#else
if(strcmp(key, MwNmodernLook) == 0) return inherit_integer(handle, key, 1);
#endif
}
return shget(handle->integer, key);
}
}
@@ -576,6 +541,19 @@ void MwVaListApply(MwWidget handle, va_list va) {
}
}
static void inherit_integer(MwWidget handle, const char* key, int default_value) {
int n;
MwWidget h = handle;
while(h != NULL) {
if((n = MwGetInteger(h, key)) != MwDEFAULT) {
MwSetInteger(handle, key, n);
return;
}
h = h->parent;
}
MwSetInteger(handle, key, default_value);
}
#if defined(USE_STB_TRUETYPE) || defined(USE_FREETYPE2)
static void set_font(MwWidget handle) {
void* f;
@@ -609,6 +587,11 @@ static void set_boldfont(MwWidget handle) {
void MwSetDefault(MwWidget handle) {
if(handle->lowlevel != NULL) MwLLSetCursor(handle->lowlevel, &MwCursorDefault, &MwCursorDefaultMask);
#ifdef USE_CLASSIC_THEME
inherit_integer(handle, MwNmodernLook, 0);
#else
inherit_integer(handle, MwNmodernLook, 1);
#endif
#if defined(USE_STB_TRUETYPE) || defined(USE_FREETYPE2)
set_font(handle);
set_boldfont(handle);
@@ -710,7 +693,7 @@ static void force_render_all(MwWidget handle) {
for(i = 0; i < arrlen(handle->children); i++) {
force_render_all(handle->children[i]);
}
if(handle->lowlevel != NULL) MwForceRender(handle);
MwForceRender(handle);
}
void MwToggleDarkTheme(MwWidget handle, int toggle) {
@@ -798,11 +781,3 @@ void MwGetCursorCoord(MwWidget handle, MwPoint* point) {
void MwGetScreenSize(MwWidget handle, MwRect* rect) {
MwLLGetScreenSize(handle->lowlevel, rect);
}
int MwGetCoordinateType(MwWidget handle) {
if(handle->parent == NULL || handle->parent->lowlevel == NULL) {
return handle->lowlevel->common.coordinate_type;
} else {
return MwCoordinatesLocal;
}
};

View File

@@ -10,8 +10,6 @@ const char* MwDefaultDarkForeground = "#ddd";
const char* MwDefaultDarkSubBackground = "#333";
const char* MwDefaultDarkSubForeground = "#ddd";
const int MwDefaultShadow = -32;
int MwDefaultBorderWidth(MwWidget handle) {
int bw = MwGetInteger(handle, MwNborderWidth);

View File

@@ -1,7 +1,6 @@
#include <Mw/Milsko.h>
#ifdef NO_IMAGE
#elif defined(USE_STB_IMAGE)
#ifdef USE_STB_IMAGE
#include "../external/stb_image.h"
#else
#include <png.h>
@@ -131,9 +130,6 @@ void MwDrawRectFading(MwWidget handle, MwRect* rect, MwLLColor color) {
}
void MwDrawFrame(MwWidget handle, MwRect* rect, MwLLColor color, int invert) {
int inv;
if((inv = MwGetInteger(handle, MwNforceInverted)) != MwDEFAULT && inv) invert = 1;
if(MwGetInteger(handle, MwNmodernLook)) {
MwDrawFrameEx(handle, rect, color, invert, MwDefaultBorderWidth(handle), 0, 0);
} else {
@@ -506,8 +502,7 @@ void MwDrawTriangle(MwWidget handle, MwRect* rect, MwLLColor color, int invert,
MwLLFreeColor(darker);
}
#if defined(NO_IMAGE)
#elif !defined(USE_STB_IMAGE)
#ifndef USE_STB_IMAGE
static void PNGCAPI user_error(png_structp png, const char* str) {
(void)str;
@@ -622,9 +617,7 @@ static unsigned char* load_jpeg(FILE* f, int* w, int* h) {
#endif
static unsigned char* load_image(const char* path, int* w, int* h) {
#if defined(NO_IMAGE)
return NULL;
#elif defined(USE_STB_IMAGE)
#ifdef USE_STB_IMAGE
int ch;
return stbi_load(path, w, h, &ch, 4);

View File

@@ -46,7 +46,7 @@ void (*MwLLFocus)(MwLL handle);
void (*MwLLGrabPointer)(MwLL handle, int toggle);
void (*MwLLSetClipboard)(MwLL handle, const char* text);
void (*MwLLGetClipboard)(MwLL handle);
char* (*MwLLGetClipboard)(MwLL handle);
void (*MwLLGetCursorCoord)(MwLL handle, MwPoint* point);
void (*MwLLGetScreenSize)(MwLL handle, MwRect* rect);

View File

@@ -294,7 +294,7 @@ static int ttf_MwTextHeight(MwWidget handle, int count) {
void MwDrawText(MwWidget handle, MwPoint* point, const char* text, int bold, int align, MwLLColor color) {
if(strlen(text) == 0) return;
#ifdef TTF
if(MwGetInteger(handle, MwNbitmapFont) || ttf_MwDrawText(handle, point, text, bold, align, color))
if(ttf_MwDrawText(handle, point, text, bold, align, color))
#endif
bitmap_MwDrawText(handle, point, text, bold, align, color);
}
@@ -304,7 +304,7 @@ int MwTextWidth(MwWidget handle, const char* text) {
#ifdef TTF
int st;
if(!MwGetInteger(handle, MwNbitmapFont) && (st = ttf_MwTextWidth(handle, text)) != -1) return st;
if((st = ttf_MwTextWidth(handle, text)) != -1) return st;
#else
(void)handle;
@@ -331,7 +331,7 @@ int MwTextHeight(MwWidget handle, const char* text) {
if(out == '\n') c++;
}
#ifdef TTF
if(!MwGetInteger(handle, MwNbitmapFont) && (st = ttf_MwTextHeight(handle, c)) != -1) return st;
if((st = ttf_MwTextHeight(handle, c)) != -1) return st;
#endif
return FontHeight * c;
}

View File

@@ -8,8 +8,6 @@ static int create(MwWidget handle) {
MwSetInteger(handle, MwNorientation, MwHORIZONTAL);
MwSetInteger(handle, MwNmargin, 0);
MwSetInteger(handle, MwNpadding, 0);
MwSetInteger(handle, MwNhasBorder, 0);
MwSetInteger(handle, MwNinverted, 1);
return 0;
}
@@ -22,11 +20,6 @@ static void draw(MwWidget handle) {
r.y = 0;
r.width = MwGetInteger(handle, MwNwidth);
r.height = MwGetInteger(handle, MwNheight);
if(MwGetInteger(handle, MwNhasBorder)) {
MwDrawFrame(handle, &r, base, MwGetInteger(handle, MwNinverted));
}
MwDrawRect(handle, &r, base);
MwLLFreeColor(base);
@@ -38,17 +31,15 @@ static void layout(MwWidget handle) {
int i;
int sum = 0;
int horiz = MwGetInteger(handle, MwNorientation) == MwHORIZONTAL ? 1 : 0;
int sz = MwGetInteger(handle, horiz ? MwNwidth : MwNheight) - (MwGetInteger(handle, MwNpadding) + (MwGetInteger(handle, MwNhasBorder) ? MwDefaultBorderWidth(handle) : 0)) * 2;
int fsz = MwGetInteger(handle, horiz ? MwNheight : MwNwidth) - (MwGetInteger(handle, MwNpadding) + (MwGetInteger(handle, MwNhasBorder) ? MwDefaultBorderWidth(handle) : 0)) * 2;
int sk = MwGetInteger(handle, MwNpadding) + (MwGetInteger(handle, MwNhasBorder) ? MwDefaultBorderWidth(handle) : 0);
int sz = MwGetInteger(handle, horiz ? MwNwidth : MwNheight) - MwGetInteger(handle, MwNpadding) * 2;
int fsz = MwGetInteger(handle, horiz ? MwNheight : MwNwidth) - MwGetInteger(handle, MwNpadding) * 2;
int sk = MwGetInteger(handle, MwNpadding);
for(i = 0; i < arrlen(handle->children); i++) {
int n = MwGetInteger(handle->children[i], MwNratio);
int s = MwGetInteger(handle->children[i], MwNfixedSize);
if(n == MwDEFAULT) n = 1;
if(handle->children[i]->destroyed) continue;
if(s != MwDEFAULT) {
sz -= s + Margin;
} else {
@@ -62,19 +53,18 @@ static void layout(MwWidget handle) {
int wsz;
if(n == MwDEFAULT) n = 1;
if(handle->children[i]->destroyed) continue;
if(s != MwDEFAULT) {
wsz = s;
} else {
wsz = sz * n / sum;
}
wsz -= Margin;
MwVaApply(handle->children[i],
horiz ? MwNx : MwNy, sk, /* this is what gets changed */
horiz ? MwNy : MwNx, MwGetInteger(handle, MwNpadding) + (MwGetInteger(handle, MwNhasBorder) ? MwDefaultBorderWidth(handle) : 0), /* fixed between widgets */
horiz ? MwNwidth : MwNheight, wsz, /* this is what gets changed */
horiz ? MwNheight : MwNwidth, fsz, /* fixed between widgets */
horiz ? MwNx : MwNy, sk, /* this is what gets changed */
horiz ? MwNy : MwNx, MwGetInteger(handle, MwNpadding), /* fixed between widgets */
horiz ? MwNwidth : MwNheight, wsz, /* this is what gets changed */
horiz ? MwNheight : MwNwidth, fsz, /* fixed between widgets */
NULL);
sk += wsz + Margin;
}
@@ -114,7 +104,7 @@ MwClassRec MwBoxClassRec = {
resize, /* resize */
children_update, /* children_update */
children_prop_change, /* children_prop_change */
NULL, /* clipboard */
NULL,
NULL,
NULL,
NULL,

View File

@@ -1,7 +1,5 @@
#include <Mw/Milsko.h>
#include "../../external/stb_ds.h"
static int create(MwWidget handle) {
MwSetDefault(handle);
@@ -20,7 +18,6 @@ static void draw(MwWidget handle) {
const char* str = MwGetText(handle, MwNtext);
MwLLPixmap px = MwGetVoid(handle, MwNpixmap);
MwLLPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap);
int inv;
if(str == NULL) str = "";
@@ -30,7 +27,7 @@ static void draw(MwWidget handle) {
r.height = MwGetInteger(handle, MwNheight);
if(MwGetInteger(handle, MwNflat)) {
if(handle->pressed || ((inv = MwGetInteger(handle, MwNforceInverted)) != MwDEFAULT && inv)) {
if(handle->pressed) {
MwDrawWidgetBack(handle, &r, base, handle->pressed, 1);
} else {
MwDrawRect(handle, &r, base);
@@ -39,7 +36,7 @@ static void draw(MwWidget handle) {
MwDrawWidgetBack(handle, &r, base, handle->pressed, 1);
}
if(bgpx != NULL) MwLLDrawPixmap(handle->lowlevel, &r, bgpx);
if(MwGetInteger(handle, MwNflat) && !(handle->pressed || ((inv = MwGetInteger(handle, MwNforceInverted)) != MwDEFAULT && inv))) {
if(MwGetInteger(handle, MwNflat) && !handle->pressed) {
r.x += MwDefaultBorderWidth(handle);
r.y += MwDefaultBorderWidth(handle);
r.width -= MwDefaultBorderWidth(handle) * 2;
@@ -107,7 +104,7 @@ MwClassRec MwButtonClassRec = {
NULL, /* resize */
NULL, /* children_update */
NULL, /* children_prop_change */
NULL, /* clipboard */
NULL,
NULL,
NULL,
NULL,

View File

@@ -53,7 +53,7 @@ MwClassRec MwCheckBoxClassRec = {
NULL, /* resize */
NULL, /* children_update */
NULL, /* children_prop_change */
NULL, /* clipboard */
NULL,
NULL,
NULL,
NULL,

View File

@@ -204,7 +204,7 @@ MwClassRec MwComboBoxClassRec = {
NULL, /* resize */
NULL, /* children_update */
NULL, /* children_prop_change */
NULL, /* clipboard */
NULL,
NULL,
NULL,
NULL,

View File

@@ -109,7 +109,20 @@ static void key(MwWidget handle, int code) {
} else if(code == MwLLKeyEnter) {
MwDispatchUserHandler(handle, MwNactivateHandler, NULL);
} else if(code == (MwLLControlMask | 'v')) {
MwLLGetClipboard(handle->lowlevel);
char* c = MwLLGetClipboard(handle->lowlevel);
if(c != NULL) {
char* out = malloc(strlen(str) + strlen(c) + 1);
MwUTF8Copy(str, 0, out, 0, t->cursor);
MwUTF8Copy(c, 0, out, t->cursor, MwUTF8Length(c));
MwUTF8Copy(str, t->cursor, out, t->cursor + MwUTF8Length(c), MwUTF8Length(str) - t->cursor);
t->cursor += MwUTF8Length(c);
MwSetText(handle, MwNtext, out);
free(out);
free(c);
}
} else if(!(code & MwLLKeyMask)) {
int incr = 0;
out = malloc(strlen(str) + 5 + 1);
@@ -144,23 +157,6 @@ static void prop_change(MwWidget handle, const char* prop) {
}
}
static void clipboard(MwWidget handle, const char* data) {
MwEntry t = handle->internal;
const char* str = MwGetText(handle, MwNtext);
char* out = malloc(strlen(str) + strlen(data) + 1);
if(str == NULL) str = "";
MwUTF8Copy(str, 0, out, 0, t->cursor);
MwUTF8Copy(data, 0, out, t->cursor, MwUTF8Length(data));
MwUTF8Copy(str, t->cursor, out, t->cursor + MwUTF8Length(data), MwUTF8Length(str) - t->cursor);
t->cursor += MwUTF8Length(data);
MwSetText(handle, MwNtext, out);
free(out);
}
MwClassRec MwEntryClassRec = {
create, /* create */
destroy, /* destroy */
@@ -177,7 +173,7 @@ MwClassRec MwEntryClassRec = {
NULL, /* resize */
NULL, /* children_update */
NULL, /* children_prop_change */
clipboard, /* clipboard */
NULL,
NULL,
NULL,
NULL,

View File

@@ -61,7 +61,7 @@ MwClassRec MwFrameClassRec = {
NULL, /* resize */
NULL, /* children_update */
NULL, /* children_prop_change */
NULL, /* clipboard */
NULL,
NULL,
NULL,
NULL,

View File

@@ -5,7 +5,6 @@ static int create(MwWidget handle) {
MwSetInteger(handle, MwNhasBorder, 0);
MwSetInteger(handle, MwNinverted, 1);
MwSetInteger(handle, MwNfillArea, 1);
return 0;
}
@@ -24,13 +23,6 @@ static void draw(MwWidget handle) {
MwDrawRect(handle, &r, base);
if(px != NULL) {
if(!MwGetInteger(handle, MwNfillArea)) {
r.x = (r.width - px->common.width) / 2;
r.y = (r.height - px->common.height) / 2;
r.width = px->common.width;
r.height = px->common.height;
}
MwLLDrawPixmap(handle->lowlevel, &r, px);
}
@@ -57,7 +49,7 @@ MwClassRec MwImageClassRec = {
NULL, /* resize */
NULL, /* children_update */
NULL, /* children_prop_change */
NULL, /* clipboard */
NULL,
NULL,
NULL,
NULL,

View File

@@ -1,139 +1,21 @@
#include <Mw/Milsko.h>
#include "../../external/stb_ds.h"
#define Spacing 1
static int create(MwWidget handle) {
MwLabel lab = malloc(sizeof(*lab));
lab->segment = NULL;
handle->internal = lab;
MwSetDefault(handle);
MwSetInteger(handle, MwNalignment, MwALIGNMENT_CENTER);
MwSetInteger(handle, MwNbold, 0);
MwSetInteger(handle, MwNsevenSegment, 0);
MwSetInteger(handle, MwNlength, 4);
MwSetInteger(handle, MwNleftPadding, 0);
return 0;
}
static void destroy(MwWidget handle) {
MwLabel lab = handle->internal;
hmfree(lab->segment);
free(handle->internal);
}
static void draw_v(MwWidget handle, unsigned char* raw, int x, int y, int stride, MwLLColor text) {
int cy, cx, b;
int l_one = MwGetInteger(handle, MwNlength) - (MwGetInteger(handle, MwNlength) % 2);
int s_one = (l_one * 3 / 4) - ((l_one * 3 / 4) % 2) + 1;
for(cy = y; cy < y + l_one; cy++) {
for(cx = x; cx < x + s_one; cx++) {
unsigned char* px = &raw[(cy * stride + cx) * 4];
px[0] = text->common.red;
px[1] = text->common.green;
px[2] = text->common.blue;
px[3] = 255;
}
}
b = y - (s_one - 1) / 2;
for(cy = b; cy < b + (s_one - 1) / 2; cy++) {
int w = (cy - b) * 2 + 1;
int b2 = x + (s_one - w) / 2;
for(cx = b2; cx < b2 + w; cx++) {
unsigned char* px;
px = &raw[(cy * stride + cx) * 4];
px[0] = text->common.red;
px[1] = text->common.green;
px[2] = text->common.blue;
px[3] = 255;
}
}
b = y + l_one;
for(cy = b; cy < b + (s_one - 1) / 2; cy++) {
int w = ((s_one - 1) / 2 - 1 - (cy - b)) * 2 + 1;
int b2 = x + (s_one - w) / 2;
for(cx = b2; cx < b2 + w; cx++) {
unsigned char* px;
px = &raw[(cy * stride + cx) * 4];
px[0] = text->common.red;
px[1] = text->common.green;
px[2] = text->common.blue;
px[3] = 255;
}
}
}
static void draw_h(MwWidget handle, unsigned char* raw, int x, int y, int stride, MwLLColor text) {
int cy, cx, b;
int l_one = MwGetInteger(handle, MwNlength) - (MwGetInteger(handle, MwNlength) % 2);
int s_one = (l_one * 3 / 4) - ((l_one * 3 / 4) % 2) + 1;
for(cx = x; cx < x + l_one; cx++) {
for(cy = y; cy < y + s_one; cy++) {
unsigned char* px = &raw[(cy * stride + cx) * 4];
px[0] = text->common.red;
px[1] = text->common.green;
px[2] = text->common.blue;
px[3] = 255;
}
}
b = x - (s_one - 1) / 2;
for(cx = b; cx < b + (s_one - 1) / 2; cx++) {
int w = (cx - b) * 2 + 1;
int b2 = y + (s_one - w) / 2;
for(cy = b2; cy < b2 + w; cy++) {
unsigned char* px;
px = &raw[(cy * stride + cx) * 4];
px[0] = text->common.red;
px[1] = text->common.green;
px[2] = text->common.blue;
px[3] = 255;
}
}
b = x + l_one;
for(cx = b; cx < b + (s_one - 1) / 2; cx++) {
int w = ((s_one - 1) / 2 - 1 - (cx - b)) * 2 + 1;
int b2 = y + (s_one - w) / 2;
for(cy = b2; cy < b2 + w; cy++) {
unsigned char* px;
px = &raw[(cy * stride + cx) * 4];
px[0] = text->common.red;
px[1] = text->common.green;
px[2] = text->common.blue;
px[3] = 255;
}
}
}
static void draw(MwWidget handle) {
MwRect r;
MwPoint p;
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
MwLLColor text = MwParseColor(handle, MwGetText(handle, MwNforeground));
MwLLColor shadow = MwLightenColor(handle, base, MwDefaultShadow, MwDefaultShadow, MwDefaultShadow);
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
MwLLColor text = MwParseColor(handle, MwGetText(handle, MwNforeground));
int align;
const char* str = MwGetText(handle, MwNtext);
MwLLPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap);
MwLabel lab = handle->internal;
int l_one = MwGetInteger(handle, MwNlength) - (MwGetInteger(handle, MwNlength) % 2);
int s_one = (l_one * 3 / 4) - ((l_one * 3 / 4) % 2) + 1;
const char* str = MwGetText(handle, MwNtext);
MwLLPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap);
if(str == NULL) str = "";
@@ -146,236 +28,41 @@ static void draw(MwWidget handle) {
if(bgpx != NULL) MwLLDrawPixmap(handle->lowlevel, &r, bgpx);
align = MwGetInteger(handle, MwNalignment);
if(MwGetInteger(handle, MwNsevenSegment)) {
MwLLPixmap px;
unsigned char* raw;
int w = 0, h = s_one * 3 + l_one * 2, i;
int x = 0;
/* so - this mode cannot do unicode.
* but you wouldn't show unicode on 7 segment anyways
*/
/* L
* S <--->
*
* S
* ^
* |
* L |
* |
* v
*/
for(i = 0; (hmgeti(lab->segment, i) != -1) || str[i] != 0; i++) {
if(i > 0 && ((hmgeti(lab->segment, i) != -1) || str[i] != '.')) w += Spacing;
if(hmgeti(lab->segment, i) != -1 || ('0' <= str[i] && str[i] <= '9') || ('A' <= str[i] && str[i] <= 'F') || ('a' <= str[i] && str[i] <= 'f')) {
w += l_one + s_one * 2;
} else if(str[i] == ':' || str[i] == ' ') {
w += s_one;
}
}
w++;
h++;
raw = malloc(w * h * 4);
memset(raw, 0, w * h * 4);
for(i = 0; (hmgeti(lab->segment, i) != -1) || str[i] != 0; i++) {
if((hmgeti(lab->segment, i) != -1) || ('0' <= str[i] && str[i] <= '9') || ('A' <= str[i] && str[i] <= 'F') || ('a' <= str[i] && str[i] <= 'f')) {
int la = 0, lb = 0, lc = 0, ld = 0, le = 0, lf = 0, lg = 0;
int j;
/* https://en.wikipedia.org/wiki/File:7_Segment_Display_with_Labeled_Segments.svg */
if(hmgeti(lab->segment, i) != -1) {
unsigned char c = hmget(lab->segment, i);
if(c & (1 << 0)) la = 1;
if(c & (1 << 1)) lb = 1;
if(c & (1 << 2)) lc = 1;
if(c & (1 << 3)) ld = 1;
if(c & (1 << 4)) le = 1;
if(c & (1 << 5)) lf = 1;
if(c & (1 << 6)) lg = 1;
} else {
if(str[i] == '0') {
la = lb = lc = ld = le = lf = 1;
} else if(str[i] == '1') {
lb = lc = 1;
} else if(str[i] == '2') {
la = lb = ld = le = lg = 1;
} else if(str[i] == '3') {
la = lb = lc = ld = lg = 1;
} else if(str[i] == '4') {
lb = lc = lf = lg = 1;
} else if(str[i] == '5') {
la = lc = ld = lf = lg = 1;
} else if(str[i] == '6') {
la = lc = ld = le = lf = lg = 1;
} else if(str[i] == '7') {
la = lb = lc = 1;
} else if(str[i] == '8') {
la = lb = lc = ld = le = lf = lg = 1;
} else if(str[i] == '9') {
la = lb = lc = ld = lf = lg = 1;
} else if(str[i] == 'A' || str[i] == 'a') {
la = lb = lc = le = lf = lg = 1;
} else if(str[i] == 'B' || str[i] == 'b') {
lc = ld = le = lf = lg = 1;
} else if(str[i] == 'C' || str[i] == 'c') {
ld = le = lg = 1;
} else if(str[i] == 'D' || str[i] == 'd') {
lb = lc = ld = le = lg = 1;
} else if(str[i] == 'E' || str[i] == 'e') {
la = ld = le = lf = lg = 1;
} else if(str[i] == 'F' || str[i] == 'f') {
la = le = lf = lg = 1;
}
}
for(j = 1; j >= 0; j--) {
MwLLColor cl = j == 1 ? shadow : text;
if(la) draw_h(handle, raw, x + s_one + j, j, w, cl);
if(lb) draw_v(handle, raw, x + s_one + l_one + j, s_one + j, w, cl);
if(lc) draw_v(handle, raw, x + s_one + l_one + j, s_one * 2 + l_one + j, w, cl);
if(ld) draw_h(handle, raw, x + s_one + j, s_one * 2 + l_one * 2 + j, w, cl);
if(le) draw_v(handle, raw, x + j, s_one * 2 + l_one + j, w, cl);
if(lf) draw_v(handle, raw, x + j, s_one + j, w, cl);
if(lg) draw_h(handle, raw, x + s_one + j, s_one + l_one + j, w, cl);
}
x += l_one + s_one * 2;
} else if(str[i] == ':') {
int cy, cx;
int j;
for(j = 1; j >= 0; j--) {
MwLLColor cl = j == 1 ? shadow : text;
for(cy = 1; cy < h - 1; cy++) {
int h = s_one / 2;
int c = (l_one - h) / 2 + s_one;
int c1 = (c <= cy && cy <= (c + h)) ? 1 : 0;
int c2 = ((s_one + l_one + c) <= cy && cy <= (s_one + l_one + c + h)) ? 1 : 0;
if(c1 || c2) {
for(cx = x; cx < x + s_one; cx++) {
unsigned char* px = &raw[((cy + j) * w + (cx + j)) * 4];
px[0] = cl->common.red;
px[1] = cl->common.green;
px[2] = cl->common.blue;
px[3] = 255;
}
}
}
}
x += s_one;
} else if(str[i] == ' ') {
x += s_one;
} else if(str[i] == '.') {
int cy, cx;
int j;
for(j = 1; j >= 0; j--) {
MwLLColor cl = j == 1 ? shadow : text;
for(cy = h - (s_one - 1) / 2 - 1; cy < h; cy++) {
for(cx = x - Spacing - (s_one - 1) / 2 - 1; cx < (x - Spacing); cx++) {
unsigned char* px = &raw[((cy + j) * w + (cx + j)) * 4];
px[0] = cl->common.red;
px[1] = cl->common.green;
px[2] = cl->common.blue;
px[3] = 255;
}
}
}
continue;
}
x += Spacing;
}
px = MwLoadRaw(handle, raw, w, h);
r.y = (r.height - h) / 2;
r.height = h;
if(align == MwALIGNMENT_CENTER) {
r.x = (r.width - w) / 2;
} else if(align == MwALIGNMENT_BEGINNING) {
r.x = 0;
} else if(align == MwALIGNMENT_END) {
r.x = r.width - w;
}
r.width = w;
MwLLDrawPixmap(handle->lowlevel, &r, px);
MwLLDestroyPixmap(px);
} else {
r.width -= MwGetInteger(handle, MwNleftPadding);
if(align == MwALIGNMENT_CENTER) {
p.x = r.width / 2;
} else if(align == MwALIGNMENT_BEGINNING) {
p.x = MwTextWidth(handle, str) / 2;
} else if(align == MwALIGNMENT_END) {
p.x = r.width - MwTextWidth(handle, str) / 2;
}
p.y = r.height / 2;
p.x += MwGetInteger(handle, MwNleftPadding);
p.x += 1;
p.y += 1;
MwDrawText(handle, &p, str, MwGetInteger(handle, MwNbold), MwALIGNMENT_CENTER, shadow);
p.x -= 1;
p.y -= 1;
MwDrawText(handle, &p, str, MwGetInteger(handle, MwNbold), MwALIGNMENT_CENTER, text);
if(align == MwALIGNMENT_CENTER) {
p.x = r.width / 2;
} else if(align == MwALIGNMENT_BEGINNING) {
p.x = MwTextWidth(handle, str) / 2;
} else if(align == MwALIGNMENT_END) {
p.x = r.width - MwTextWidth(handle, str) / 2;
}
p.y = r.height / 2;
MwDrawText(handle, &p, str, MwGetInteger(handle, MwNbold), MwALIGNMENT_CENTER, text);
MwLLFreeColor(shadow);
MwLLFreeColor(text);
MwLLFreeColor(base);
}
static void prop_change(MwWidget handle, const char* key) {
if(strcmp(key, MwNtext) == 0 || strcmp(key, MwNalignment) == 0 || strcmp(key, MwNsevenSegment) == 0 || strcmp(key, MwNlength) == 0 || strcmp(key, MwNleftPadding) == 0) MwForceRender(handle);
}
static void mwLabelSetSevenSegmentImpl(MwWidget handle, int index, unsigned char data) {
MwLabel lab = handle->internal;
hmput(lab->segment, index, data);
}
static void func_handler(MwWidget handle, const char* name, void* out, va_list va) {
(void)out;
if(strcmp(name, "mwLabelSetSevenSegment") == 0) {
int index = va_arg(va, int);
int data = va_arg(va, int);
mwLabelSetSevenSegmentImpl(handle, index, data);
}
if(strcmp(key, MwNtext) == 0 || strcmp(key, MwNalignment) == 0) MwForceRender(handle);
}
MwClassRec MwLabelClassRec = {
create, /* create */
destroy, /* destroy */
draw, /* draw */
NULL, /* click */
NULL, /* parent_resize */
prop_change, /* prop_change */
NULL, /* mouse_move */
NULL, /* mouse_up */
NULL, /* mouse_down */
NULL, /* key */
func_handler, /* execute */
NULL, /* tick */
NULL, /* resize */
NULL, /* children_update */
NULL, /* children_prop_change */
NULL, /* clipboard */
create, /* create */
NULL, /* destroy */
draw, /* draw */
NULL, /* click */
NULL, /* parent_resize */
prop_change, /* prop_change */
NULL, /* mouse_move */
NULL, /* mouse_up */
NULL, /* mouse_down */
NULL, /* key */
NULL, /* execute */
NULL, /* tick */
NULL, /* resize */
NULL, /* children_update */
NULL, /* children_prop_change */
NULL,
NULL,
NULL,
NULL,

View File

@@ -608,7 +608,7 @@ MwClassRec MwListBoxClassRec = {
NULL, /* resize */
NULL, /* children_update */
NULL, /* children_prop_change */
NULL, /* clipboard */
NULL,
NULL,
NULL,
NULL,

View File

@@ -129,7 +129,7 @@ static void mouse_down(MwWidget handle, void* ptr) {
p2.y = p.y + th / 2 + 5;
m->sub[i]->wsub = MwCreateWidget(MwSubMenuClass, "submenu", handle, 0, 0, 0, 0);
MwSubMenuAppear(m->sub[i]->wsub, m->sub[i], &p2, 0);
MwSubMenuAppear(m->sub[i]->wsub, m->sub[i], &p2);
} else if(m->sub[i]->wsub != NULL && m->sub[i]->keep) {
MwDestroyWidget(m->sub[i]->wsub);
m->sub[i]->wsub = NULL;
@@ -204,7 +204,7 @@ MwClassRec MwMenuClassRec = {
NULL, /* resize */
NULL, /* children_update */
NULL, /* children_prop_change */
NULL, /* clipboard */
NULL,
NULL,
NULL,
NULL,

View File

@@ -143,7 +143,7 @@ MwClassRec MwNumberEntryClassRec = {
NULL, /* resize */
NULL, /* children_update */
NULL, /* children_prop_change */
NULL, /* clipboard */
NULL,
NULL,
NULL,
NULL,

View File

@@ -42,19 +42,6 @@ typedef struct x11opengl {
} x11opengl_t;
#endif
#ifdef USE_WAYLAND
#include <EGL/egl.h>
#include <wayland-egl-core.h>
typedef struct waylandopengl {
EGLNativeWindowType egl_window_native;
EGLDisplay egl_display;
EGLContext egl_context;
EGLSurface egl_surface;
EGLConfig egl_config;
} waylandopengl_t;
#endif
static int create(MwWidget handle) {
void* r = NULL;
#ifdef USE_GDI
@@ -118,90 +105,7 @@ static int create(MwWidget handle) {
#endif
#ifdef USE_WAYLAND
if(handle->lowlevel->common.type == MwLLBackendWayland) {
int err;
EGLint numConfigs;
EGLint majorVersion;
EGLint minorVersion;
EGLContext context;
EGLSurface surface;
EGLint fbAttribs[] =
{
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
EGL_RED_SIZE, 8,
EGL_GREEN_SIZE, 8,
EGL_BLUE_SIZE, 8,
EGL_DEPTH_SIZE, 24,
EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
EGL_NONE};
EGLint contextAttribs[] = {
EGL_CONTEXT_CLIENT_VERSION, 1,
EGL_CONTEXT_MAJOR_VERSION, 1,
EGL_CONTEXT_MINOR_VERSION, 1,
EGL_NONE};
EGLDisplay display;
waylandopengl_t* o = r = malloc(sizeof(*o));
MwLL topmost_parent = handle->lowlevel->wayland.parent;
topmost_parent->wayland.always_render = MwTRUE;
while(topmost_parent->wayland.parent != NULL) {
topmost_parent = topmost_parent->wayland.parent;
topmost_parent->wayland.always_render = MwTRUE;
}
display = eglGetDisplay((EGLNativeDisplayType)handle->lowlevel->wayland.display);
if(display == EGL_NO_DISPLAY) {
printf("ERROR: eglGetDisplay, %0X\n", eglGetError());
return MwFALSE;
}
/* Initialize EGL */
if(!eglInitialize(display, &majorVersion, &minorVersion)) {
printf("ERROR: eglInitialize, %0X\n", eglGetError());
return MwFALSE;
}
/* Get configs */
if((eglGetConfigs(display, NULL, 0, &numConfigs) != EGL_TRUE) || (numConfigs == 0)) {
printf("ERROR: eglGetConfigs, %0X\n", eglGetError());
return MwFALSE;
}
/* Choose config */
if((eglChooseConfig(display, fbAttribs, &o->egl_config, 1, &numConfigs) != EGL_TRUE) || (numConfigs != 1)) {
printf("ERROR: eglChooseConfig, %0X\n", eglGetError());
return MwFALSE;
}
o->egl_window_native =
(EGLNativeWindowType)wl_egl_window_create(handle->lowlevel->wayland.framebuffer.surface, handle->lowlevel->wayland.ww, handle->lowlevel->wayland.wh);
if(!o->egl_window_native) {
printf("ERROR: wl_egl_window_create, EGL_NO_SURFACE\n");
return MwFALSE;
}
/* Create a surface */
surface = eglCreateWindowSurface(display, o->egl_config, o->egl_window_native, NULL);
if(surface == EGL_NO_SURFACE) {
printf("ERROR: eglCreateWindowSurface, %0X\n", eglGetError());
return MwFALSE;
}
eglBindAPI(EGL_OPENGL_API);
/* Create a GL context */
context = eglCreateContext(display, o->egl_config, EGL_NO_CONTEXT, contextAttribs);
if(context == EGL_NO_CONTEXT) {
printf("ERROR: eglCreateContext, %0X\n", eglGetError());
return MwFALSE;
}
if(!eglMakeCurrent(display, surface, surface, context)) {
printf("ERROR: eglMakeCurrent (setup): %0X\n", eglGetError());
}
o->egl_display = display;
o->egl_surface = surface;
o->egl_context = context;
/* todo */
}
#endif
@@ -261,11 +165,7 @@ static void mwOpenGLMakeCurrentImpl(MwWidget handle) {
#endif
#ifdef USE_WAYLAND
if(handle->lowlevel->common.type == MwLLBackendWayland) {
waylandopengl_t* o = handle->internal;
if(!eglMakeCurrent(o->egl_display, o->egl_surface, o->egl_surface, o->egl_context)) {
printf("ERROR: eglMakeCurrent, %0X\n", eglGetError());
}
/* todo */
}
#endif
}
@@ -287,13 +187,7 @@ static void mwOpenGLSwapBufferImpl(MwWidget handle) {
#endif
#ifdef USE_WAYLAND
if(handle->lowlevel->common.type == MwLLBackendWayland) {
waylandopengl_t* o = handle->internal;
eglSwapInterval(o->egl_display, 0);
if(!eglSwapBuffers(o->egl_display, o->egl_surface)) {
printf("ERROR: eglSwapBuffers, %0X\n", eglGetError());
};
wl_egl_window_resize((struct wl_egl_window*)o->egl_window_native, handle->lowlevel->wayland.ww, handle->lowlevel->wayland.wh, 0, 0);
MwLLForceRender(handle->lowlevel);
/* todo */
}
#endif
}
@@ -315,7 +209,7 @@ static void* mwOpenGLGetProcAddressImpl(MwWidget handle, const char* name) {
#endif
#ifdef USE_WAYLAND
if(handle->lowlevel->common.type == MwLLBackendWayland) {
return eglGetProcAddress(name);
/* todo */
}
#endif
return NULL;
@@ -350,7 +244,7 @@ MwClassRec MwOpenGLClassRec = {
NULL, /* resize */
NULL, /* children_update */
NULL, /* children_prop_change */
NULL, /* clipboard */
NULL,
NULL,
NULL,
NULL,

View File

@@ -61,7 +61,7 @@ MwClassRec MwProgressBarClassRec = {
NULL, /* resize */
NULL, /* children_update */
NULL, /* children_prop_change */
NULL, /* clipboard */
NULL,
NULL,
NULL,
NULL,

View File

@@ -62,7 +62,7 @@ MwClassRec MwRadioBoxClassRec = {
NULL, /* resize */
NULL, /* children_update */
NULL, /* children_prop_change */
NULL, /* clipboard */
NULL,
NULL,
NULL,
NULL,

View File

@@ -1,7 +1,13 @@
#include <Mw/Milsko.h>
typedef struct scrollbar {
MwPoint point;
int drag;
int pos;
} scrollbar_t;
static int create(MwWidget handle) {
MwScrollBar scr = malloc(sizeof(*scr));
scrollbar_t* scr = malloc(sizeof(*scr));
handle->internal = scr;
@@ -54,10 +60,10 @@ static void add_value(MwWidget handle, int mul) {
}
static void draw(MwWidget handle) {
MwRect r, rt, rbar;
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
MwLLColor dark = MwLightenColor(handle, base, -64, -64, -64);
MwScrollBar scr = handle->internal;
MwRect r, rt, rbar;
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
MwLLColor dark = MwLightenColor(handle, base, -64, -64, -64);
scrollbar_t* scr = handle->internal;
int or ;
int uy, dy, ux, dx;
MwLLPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap);
@@ -138,8 +144,8 @@ static void draw(MwWidget handle) {
}
static void mouse_move(MwWidget handle) {
int or = MwGetInteger(handle, MwNorientation);
MwScrollBar scr = handle->internal;
int or = MwGetInteger(handle, MwNorientation);
scrollbar_t* scr = handle->internal;
if(!handle->pressed) return;
@@ -166,11 +172,11 @@ static void mouse_move(MwWidget handle) {
}
static void mouse_down(MwWidget handle, void* ptr) {
int ww = MwGetInteger(handle, MwNwidth);
int wh = MwGetInteger(handle, MwNheight);
int or = MwGetInteger(handle, MwNorientation);
MwScrollBar scr = handle->internal;
MwLLMouse* m = ptr;
int ww = MwGetInteger(handle, MwNwidth);
int wh = MwGetInteger(handle, MwNheight);
int or = MwGetInteger(handle, MwNorientation);
scrollbar_t* scr = handle->internal;
MwLLMouse* m = ptr;
if(m->button == MwLLMouseWheelUp) {
int min = MwGetInteger(handle, MwNminValue);
@@ -272,7 +278,7 @@ MwClassRec MwScrollBarClassRec = {
NULL, /* resize */
NULL, /* children_update */
NULL, /* children_prop_change */
NULL, /* clipboard */
NULL,
NULL,
NULL,
NULL,

View File

@@ -50,7 +50,7 @@ MwClassRec MwSeparatorClassRec = {
NULL, /* resize */
NULL, /* children_update */
NULL, /* children_prop_change */
NULL, /* clipboard */
NULL,
NULL,
NULL,
NULL,

View File

@@ -6,7 +6,6 @@ static int create(MwWidget handle) {
MwLLBeginStateChange(handle->lowlevel);
MwSetDefault(handle);
MwSetInteger(handle, MwNleftPadding, 0);
return 0;
}
@@ -54,27 +53,25 @@ static void draw(MwWidget handle) {
rc.x = MwDefaultBorderWidth(handle) * 2;
rc.y = p.y;
rc.width = r.width - (rc.x * 2) - MwGetInteger(handle, MwNleftPadding);
rc.height = 2;
rc.width = r.width - (rc.x * 2);
rc.height = MwDefaultBorderWidth(handle) * 2;
rc.x += MwGetInteger(handle, MwNleftPadding);
MwDrawFrame(handle, &rc, base, 1);
MwDrawFrameEx(handle, &rc, base, 1, 1, 0, 0);
p.y += 2 + 1;
p.y += MwDefaultBorderWidth(handle) * 2 + 1;
} else {
int tw = MwTextWidth(handle, menu->sub[i]->name);
int th = MwTextHeight(handle, menu->sub[i]->name);
if(menu->sub[i]->wsub != NULL) {
r.x = MwGetInteger(handle, MwNleftPadding);
r.x = 0;
r.y = p.y - 3;
r.width = MwGetInteger(handle, MwNwidth) - MwGetInteger(handle, MwNleftPadding);
r.width = tw + 15 + 5 * 2;
r.height = th + 3 * 2;
MwDrawWidgetBack(handle, &r, base, 0, MwTRUE);
}
p.x = 5 + tw / 2 + MwGetInteger(handle, MwNleftPadding);
p.x = 5 + tw / 2;
p.y += th / 2;
MwDrawText(handle, &p, menu->sub[i]->name, menu->sub[i]->wsub != NULL ? 1 : 0, MwALIGNMENT_CENTER, text);
@@ -82,7 +79,7 @@ static void draw(MwWidget handle) {
if(arrlen(menu->sub[i]->sub) > 0) {
MwRect tr;
tr.x = MwGetInteger(handle, MwNwidth) - MwDefaultBorderWidth(handle) - 11 - 2;
tr.x = p.x + tw / 2 + 5;
tr.y = p.y - th / 2 + 2;
tr.width = tr.height = 11;
@@ -119,11 +116,7 @@ static void click(MwWidget handle) {
int th = MwTextHeight(handle, menu->sub[i]->name);
rc.height = th;
if(strcmp(menu->sub[i]->name, "----") == 0) {
rc.height = 2 - 1;
}
if(MwGetInteger(handle, MwNleftPadding) <= handle->mouse_point.x && rc.y <= handle->mouse_point.y && handle->mouse_point.y <= (int)(rc.y + rc.height)) {
if(rc.x <= handle->mouse_point.x && rc.y <= handle->mouse_point.y && handle->mouse_point.x <= (int)(rc.x + rc.width) && handle->mouse_point.y <= (int)(rc.y + rc.height)) {
if(menu->sub[i]->wsub == NULL && arrlen(menu->sub[i]->sub) > 0) {
MwPoint p;
int j;
@@ -133,14 +126,14 @@ static void click(MwWidget handle) {
menu->sub[j]->wsub = NULL;
}
p.x = MwGetInteger(handle, MwNwidth);
p.x = rc.x + rc.width + 3;
p.y = rc.y - 3;
menu->sub[i]->wsub = MwCreateWidget(MwSubMenuClass, "submenu", handle, 0, 0, 0, 0);
MwSubMenuAppear(menu->sub[i]->wsub, menu->sub[i], &p, 0);
MwSubMenuAppear(menu->sub[i]->wsub, menu->sub[i], &p);
i = -1;
} else if(menu->sub[i]->wsub != NULL && arrlen(menu->sub[i]->sub) > 0) {
while(w->parent->widget_class == MwSubMenuClass) w = w->parent;
while(w->parent->widget_class != MwMenuClass) w = w->parent;
MwDestroyWidget(menu->sub[i]->wsub);
menu->sub[i]->wsub = NULL;
@@ -149,7 +142,7 @@ static void click(MwWidget handle) {
MwForceRender(handle);
} else if(strcmp(menu->sub[i]->name, "----") != 0 && arrlen(menu->sub[i]->sub) == 0) {
while(w->parent->widget_class == MwSubMenuClass) w = w->parent;
while(w->parent->widget_class != MwMenuClass) w = w->parent;
MwGetBeforeStep(w, &jmp);
MwDestroyWidget(w);
@@ -166,77 +159,43 @@ static void click(MwWidget handle) {
}
}
static void mwSubMenuAppearImpl(MwWidget handle, MwMenu menu, MwPoint* point, int diff_calc) {
MwRect rc, sz;
MwPoint p = *point;
MwSubMenuGetSize(handle, menu, &sz);
MwGetScreenSize(handle, &rc);
static void mwSubMenuAppearImpl(MwWidget handle, MwMenu menu, MwPoint* point) {
int i, w = 0, h = 0;
handle->internal = menu;
if(diff_calc) {
p.y = p.y - sz.height;
}
MwLLMakeToolWindow(handle->lowlevel);
MwLLDetach(handle->lowlevel, &p);
if(handle->lowlevel->common.coordinate_type == MwCoordinatesGlobal) {
if(MwGetInteger(handle, MwNy) + sz.height > rc.height) {
MwVaApply(handle,
MwNy, rc.height - sz.height,
NULL);
}
}
MwLLDetach(handle->lowlevel, point);
MwLLEndStateChange(handle->lowlevel);
MwVaApply(handle,
MwNwidth, sz.width,
MwNheight, sz.height,
NULL);
}
static void mwSubMenuGetSizeImpl(MwWidget handle, MwMenu menu, MwRect* rect) {
int i;
rect->width = 0;
rect->height = 0;
for(i = 0; i < arrlen(menu->sub); i++) {
if(strcmp(menu->sub[i]->name, "----") == 0) {
rect->height += 2 + 2;
h += MwDefaultBorderWidth(handle) * 2 + 2;
} else {
int tw = MwTextWidth(handle, menu->sub[i]->name);
rect->height += MwTextHeight(handle, menu->sub[i]->name) + 3;
if(tw > rect->width) {
rect->width = tw;
h += MwTextHeight(handle, menu->sub[i]->name) + 3;
if(tw > w) {
w = tw;
}
}
}
rect->width += MwGetInteger(handle, MwNleftPadding);
w += 10 + 15;
h += 3;
rect->width += 10 + 15;
rect->height += 3;
rect->width += 16;
MwVaApply(handle,
MwNwidth, w,
MwNheight, h,
NULL);
}
static void func_handler(MwWidget handle, const char* name, void* out, va_list va) {
(void)out;
if(strcmp(name, "mwSubMenuAppear") == 0) {
MwMenu menu = va_arg(va, MwMenu);
MwPoint* point = va_arg(va, MwPoint*);
int diff_calc = va_arg(va, int);
mwSubMenuAppearImpl(handle, menu, point, diff_calc);
} else if(strcmp(name, "mwSubMenuGetSize") == 0) {
MwMenu menu = va_arg(va, MwMenu);
MwRect* rect = va_arg(va, MwRect*);
mwSubMenuGetSizeImpl(handle, menu, rect);
MwMenu menu = va_arg(va, MwMenu);
MwPoint* point = va_arg(va, MwPoint*);
mwSubMenuAppearImpl(handle, menu, point);
}
}
@@ -256,7 +215,7 @@ MwClassRec MwSubMenuClassRec = {
NULL, /* resize */
NULL, /* children_update */
NULL, /* children_prop_change */
NULL, /* clipboard */
NULL,
NULL,
NULL,
NULL,

View File

@@ -496,7 +496,7 @@ MwClassRec MwTreeViewClassRec = {
NULL, /* resize */
NULL, /* children_update */
NULL, /* children_prop_change */
NULL, /* clipboard */
NULL,
NULL,
NULL,
NULL,

View File

@@ -191,7 +191,7 @@ MwClassRec MwViewportClassRec = {
NULL, /* resize */
NULL, /* children_update */
NULL, /* children_prop_change */
NULL, /* clipboard */
NULL,
NULL,
NULL,
NULL,

View File

@@ -13,9 +13,6 @@
#ifdef USE_X11
#define VK_USE_PLATFORM_XLIB_KHR 1
#endif
#ifdef USE_WAYLAND
#define VK_USE_PLATFORM_WAYLAND_KHR 1
#endif
#include <vulkan/vulkan.h>
#include <vulkan/vulkan_core.h>
@@ -25,9 +22,6 @@
#ifdef USE_X11
#include <vulkan/vulkan_xlib.h>
#endif
#ifdef USE_WAYLAND
#include <vulkan/vulkan_wayland.h>
#endif
#ifdef HAS_VK_ENUM_STRING_HELPER
#include <vulkan/vk_enum_string_helper.h>
@@ -225,20 +219,6 @@ static MwErrorEnum vulkan_instance_setup(MwWidget handle, vulkan_t* o) {
arrput(enabledExtensions, VK_KHR_XLIB_SURFACE_EXTENSION_NAME);
}
#endif
#ifdef USE_WAYLAND
if(handle->lowlevel->common.type == MwLLBackendWayland) {
MwLL topmost_parent = handle->lowlevel->wayland.parent;
arrput(enabledExtensions, VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME);
/* take this opprutunity to set the widget to always render */
topmost_parent->wayland.always_render = MwTRUE;
while(topmost_parent->wayland.parent != NULL) {
topmost_parent = topmost_parent->wayland.parent;
topmost_parent->wayland.always_render = MwTRUE;
}
}
#endif
/* passing null gives us all the extensions provided by the current vulkan implementation */
VK_CMD(_vkEnumerateInstanceExtensionProperties(NULL, &extension_count, NULL));
@@ -333,20 +313,6 @@ static MwErrorEnum vulkan_surface_setup(MwWidget handle, vulkan_t* o) {
};
VK_CMD(_vkCreateXlibSurfaceKHR(o->vkInstance, &createInfo, NULL, &o->vkSurface));
}
#endif
#ifdef USE_WAYLAND
if(handle->lowlevel->common.type == MwLLBackendWayland) {
LOAD_VK_FUNCTION(vkCreateWaylandSurfaceKHR);
VkWaylandSurfaceCreateInfoKHR createInfo = {
.sType = VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR,
.pNext = NULL,
.flags = 0,
.display = handle->lowlevel->wayland.display,
.surface = handle->lowlevel->wayland.framebuffer.surface,
};
VK_CMD(_vkCreateWaylandSurfaceKHR(o->vkInstance, &createInfo, NULL, &o->vkSurface));
}
#endif
return MwEsuccess;
}
@@ -558,7 +524,7 @@ MwClassRec MwVulkanClassRec = {
NULL, /* resize */
NULL, /* children_update */
NULL, /* children_prop_change */
NULL, /* clipboard */
NULL,
NULL,
NULL,
NULL,

View File

@@ -59,7 +59,7 @@ MwClassRec MwWindowClassRec = {
NULL, /* resize */
NULL, /* children_update */
NULL, /* children_prop_change */
NULL, /* clipboard */
NULL,
NULL,
NULL,
NULL,

View File

@@ -1,105 +0,0 @@
#!/usr/bin/env perl
our $clean = 0;
my @objs = ();
sub compile {
my ($source) = @_;
my $object = "";
my $dir = "";
$dir = $source;
$dir =~ s/\/([^\/]+)$//;
$source =~ s/^(.+)\/([^\/]+)$/[\/\1]\2/;
$source =~ s/\//\./g;
$object = $source;
$object =~ s/\.c$/.obj/;
print(OUT "\$ if f\$search(\"$object;*\") .eqs. \"\"\n");
print(OUT "\$ then\n");
print(OUT "\$ write sys\$output \"CC $object\"\n");
print(OUT
"\$ cc /include_directory=(\"./include\",\"./$dir\") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=$object $source\n"
);
print(OUT "\$ endif\n");
push(@objs, $object);
}
sub clean {
my ($source) = @_;
my $object = "";
my $dir = "";
$source =~ s/^(.+)\/([^\/]+)$/[\/\1]\2/;
$source =~ s/\//\./g;
$object = $source;
$object =~ s/\.c$/.obj/;
print(OUT
"\$ if f\$search(\"$object\") .nes. \"\" then delete $object;*\n");
}
sub thing {
if ($clean) {
clean($_[0]);
}
else {
compile($_[0]);
}
}
sub scan {
my ($dir) = @_;
opendir(my $dh, $dir);
while (my $file = readdir($dh)) {
if ( !(($dir . "/" . $file) eq "src/widget/opengl.c")
&& !(($dir . "/" . $file) eq "src/widget/vulkan.c")
&& !(($dir . "/" . $file) eq "external/stb_truetype.c")
&& !(($dir . "/" . $file) eq "external/stb_image.c")
&& ($file =~ /\.c$/))
{
thing($dir . "/" . $file);
}
}
closedir($dh);
}
for (my $i = 0 ; $i < 2 ; $i++) {
$clean = $i;
open(OUT, ">", $i == 0 ? "vms/build.com" : "vms/clean.com");
scan("src");
scan("src/cursor");
scan("src/widget");
scan("src/dialog");
scan("src/font");
scan("src/icon");
scan("src/abstract");
scan("external");
thing("src/backend/x11.c");
if ($i == 0) {
print(OUT "\$ if f\$search(\"[.src]MwSHR.exe;*\") .eqs. \"\"\n");
print(OUT "\$ then\n");
print(OUT "\$ write sys\$output \"LINK [.src]MwSHR.exe\"\n");
print(OUT "\$ OPEN /WRITE LINK_OPT LINK.OPT\n");
foreach my $obj (@objs) {
print(OUT "\$ WRITE LINK_OPT \"$obj\"\n");
}
print(OUT "\$ WRITE LINK_OPT \"SYS\$LIBRARY:DECW\$XLIBSHR/SHARE\"\n");
print(OUT "\$ WRITE LINK_OPT \"SYS\$LIBRARY:DPML\$SHR/SHARE\"\n");
print(OUT "\$ CLOSE LINK_OPT\n");
print(OUT "\$ link /SHAREABLE=[.src]MwSHR.exe LINK.OPT/options\n");
print(OUT "\$ DELETE LINK.OPT;*\n");
print(OUT "\$ endif\n");
}
else {
clean("src/MwSHR.exe");
}
close(OUT);
}

View File

@@ -1,382 +0,0 @@
$ if f$search("[.src]color.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src]color.obj"
$ cc /include_directory=("./include","./src") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src]color.obj [.src]color.c
$ endif
$ if f$search("[.src]core.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src]core.obj"
$ cc /include_directory=("./include","./src") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src]core.obj [.src]core.c
$ endif
$ if f$search("[.src]default.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src]default.obj"
$ cc /include_directory=("./include","./src") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src]default.obj [.src]default.c
$ endif
$ if f$search("[.src]draw.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src]draw.obj"
$ cc /include_directory=("./include","./src") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src]draw.obj [.src]draw.c
$ endif
$ if f$search("[.src]error.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src]error.obj"
$ cc /include_directory=("./include","./src") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src]error.obj [.src]error.c
$ endif
$ if f$search("[.src]lowlevel.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src]lowlevel.obj"
$ cc /include_directory=("./include","./src") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src]lowlevel.obj [.src]lowlevel.c
$ endif
$ if f$search("[.src]string.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src]string.obj"
$ cc /include_directory=("./include","./src") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src]string.obj [.src]string.c
$ endif
$ if f$search("[.src]text.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src]text.obj"
$ cc /include_directory=("./include","./src") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src]text.obj [.src]text.c
$ endif
$ if f$search("[.src]unicode.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src]unicode.obj"
$ cc /include_directory=("./include","./src") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src]unicode.obj [.src]unicode.c
$ endif
$ if f$search("[.src.cursor]arrow.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.cursor]arrow.obj"
$ cc /include_directory=("./include","./src/cursor") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.cursor]arrow.obj [.src.cursor]arrow.c
$ endif
$ if f$search("[.src.cursor]cross.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.cursor]cross.obj"
$ cc /include_directory=("./include","./src/cursor") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.cursor]cross.obj [.src.cursor]cross.c
$ endif
$ if f$search("[.src.cursor]default.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.cursor]default.obj"
$ cc /include_directory=("./include","./src/cursor") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.cursor]default.obj [.src.cursor]default.c
$ endif
$ if f$search("[.src.cursor]hidden.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.cursor]hidden.obj"
$ cc /include_directory=("./include","./src/cursor") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.cursor]hidden.obj [.src.cursor]hidden.c
$ endif
$ if f$search("[.src.cursor]text.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.cursor]text.obj"
$ cc /include_directory=("./include","./src/cursor") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.cursor]text.obj [.src.cursor]text.c
$ endif
$ if f$search("[.src.widget]button.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.widget]button.obj"
$ cc /include_directory=("./include","./src/widget") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.widget]button.obj [.src.widget]button.c
$ endif
$ if f$search("[.src.widget]checkbox.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.widget]checkbox.obj"
$ cc /include_directory=("./include","./src/widget") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.widget]checkbox.obj [.src.widget]checkbox.c
$ endif
$ if f$search("[.src.widget]combobox.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.widget]combobox.obj"
$ cc /include_directory=("./include","./src/widget") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.widget]combobox.obj [.src.widget]combobox.c
$ endif
$ if f$search("[.src.widget]entry.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.widget]entry.obj"
$ cc /include_directory=("./include","./src/widget") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.widget]entry.obj [.src.widget]entry.c
$ endif
$ if f$search("[.src.widget]frame.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.widget]frame.obj"
$ cc /include_directory=("./include","./src/widget") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.widget]frame.obj [.src.widget]frame.c
$ endif
$ if f$search("[.src.widget]image.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.widget]image.obj"
$ cc /include_directory=("./include","./src/widget") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.widget]image.obj [.src.widget]image.c
$ endif
$ if f$search("[.src.widget]label.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.widget]label.obj"
$ cc /include_directory=("./include","./src/widget") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.widget]label.obj [.src.widget]label.c
$ endif
$ if f$search("[.src.widget]listbox.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.widget]listbox.obj"
$ cc /include_directory=("./include","./src/widget") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.widget]listbox.obj [.src.widget]listbox.c
$ endif
$ if f$search("[.src.widget]menu.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.widget]menu.obj"
$ cc /include_directory=("./include","./src/widget") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.widget]menu.obj [.src.widget]menu.c
$ endif
$ if f$search("[.src.widget]numberentry.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.widget]numberentry.obj"
$ cc /include_directory=("./include","./src/widget") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.widget]numberentry.obj [.src.widget]numberentry.c
$ endif
$ if f$search("[.src.widget]progressbar.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.widget]progressbar.obj"
$ cc /include_directory=("./include","./src/widget") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.widget]progressbar.obj [.src.widget]progressbar.c
$ endif
$ if f$search("[.src.widget]radiobox.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.widget]radiobox.obj"
$ cc /include_directory=("./include","./src/widget") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.widget]radiobox.obj [.src.widget]radiobox.c
$ endif
$ if f$search("[.src.widget]scrollbar.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.widget]scrollbar.obj"
$ cc /include_directory=("./include","./src/widget") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.widget]scrollbar.obj [.src.widget]scrollbar.c
$ endif
$ if f$search("[.src.widget]separator.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.widget]separator.obj"
$ cc /include_directory=("./include","./src/widget") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.widget]separator.obj [.src.widget]separator.c
$ endif
$ if f$search("[.src.widget]submenu.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.widget]submenu.obj"
$ cc /include_directory=("./include","./src/widget") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.widget]submenu.obj [.src.widget]submenu.c
$ endif
$ if f$search("[.src.widget]treeview.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.widget]treeview.obj"
$ cc /include_directory=("./include","./src/widget") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.widget]treeview.obj [.src.widget]treeview.c
$ endif
$ if f$search("[.src.widget]viewport.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.widget]viewport.obj"
$ cc /include_directory=("./include","./src/widget") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.widget]viewport.obj [.src.widget]viewport.c
$ endif
$ if f$search("[.src.widget]window.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.widget]window.obj"
$ cc /include_directory=("./include","./src/widget") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.widget]window.obj [.src.widget]window.c
$ endif
$ if f$search("[.src.widget]box.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.widget]box.obj"
$ cc /include_directory=("./include","./src/widget") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.widget]box.obj [.src.widget]box.c
$ endif
$ if f$search("[.src.dialog]colorpicker.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.dialog]colorpicker.obj"
$ cc /include_directory=("./include","./src/dialog") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.dialog]colorpicker.obj [.src.dialog]colorpicker.c
$ endif
$ if f$search("[.src.dialog]directorychooser.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.dialog]directorychooser.obj"
$ cc /include_directory=("./include","./src/dialog") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.dialog]directorychooser.obj [.src.dialog]directorychooser.c
$ endif
$ if f$search("[.src.dialog]filechooser.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.dialog]filechooser.obj"
$ cc /include_directory=("./include","./src/dialog") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.dialog]filechooser.obj [.src.dialog]filechooser.c
$ endif
$ if f$search("[.src.dialog]messagebox.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.dialog]messagebox.obj"
$ cc /include_directory=("./include","./src/dialog") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.dialog]messagebox.obj [.src.dialog]messagebox.c
$ endif
$ if f$search("[.src.font]boldfont.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.font]boldfont.obj"
$ cc /include_directory=("./include","./src/font") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.font]boldfont.obj [.src.font]boldfont.c
$ endif
$ if f$search("[.src.font]boldttf.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.font]boldttf.obj"
$ cc /include_directory=("./include","./src/font") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.font]boldttf.obj [.src.font]boldttf.c
$ endif
$ if f$search("[.src.font]font.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.font]font.obj"
$ cc /include_directory=("./include","./src/font") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.font]font.obj [.src.font]font.c
$ endif
$ if f$search("[.src.font]ttf.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.font]ttf.obj"
$ cc /include_directory=("./include","./src/font") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.font]ttf.obj [.src.font]ttf.c
$ endif
$ if f$search("[.src.icon]back.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.icon]back.obj"
$ cc /include_directory=("./include","./src/icon") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.icon]back.obj [.src.icon]back.c
$ endif
$ if f$search("[.src.icon]clock.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.icon]clock.obj"
$ cc /include_directory=("./include","./src/icon") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.icon]clock.obj [.src.icon]clock.c
$ endif
$ if f$search("[.src.icon]computer.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.icon]computer.obj"
$ cc /include_directory=("./include","./src/icon") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.icon]computer.obj [.src.icon]computer.c
$ endif
$ if f$search("[.src.icon]directory.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.icon]directory.obj"
$ cc /include_directory=("./include","./src/icon") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.icon]directory.obj [.src.icon]directory.c
$ endif
$ if f$search("[.src.icon]down.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.icon]down.obj"
$ cc /include_directory=("./include","./src/icon") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.icon]down.obj [.src.icon]down.c
$ endif
$ if f$search("[.src.icon]error.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.icon]error.obj"
$ cc /include_directory=("./include","./src/icon") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.icon]error.obj [.src.icon]error.c
$ endif
$ if f$search("[.src.icon]file.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.icon]file.obj"
$ cc /include_directory=("./include","./src/icon") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.icon]file.obj [.src.icon]file.c
$ endif
$ if f$search("[.src.icon]forward.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.icon]forward.obj"
$ cc /include_directory=("./include","./src/icon") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.icon]forward.obj [.src.icon]forward.c
$ endif
$ if f$search("[.src.icon]info.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.icon]info.obj"
$ cc /include_directory=("./include","./src/icon") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.icon]info.obj [.src.icon]info.c
$ endif
$ if f$search("[.src.icon]left.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.icon]left.obj"
$ cc /include_directory=("./include","./src/icon") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.icon]left.obj [.src.icon]left.c
$ endif
$ if f$search("[.src.icon]news.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.icon]news.obj"
$ cc /include_directory=("./include","./src/icon") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.icon]news.obj [.src.icon]news.c
$ endif
$ if f$search("[.src.icon]note.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.icon]note.obj"
$ cc /include_directory=("./include","./src/icon") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.icon]note.obj [.src.icon]note.c
$ endif
$ if f$search("[.src.icon]right.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.icon]right.obj"
$ cc /include_directory=("./include","./src/icon") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.icon]right.obj [.src.icon]right.c
$ endif
$ if f$search("[.src.icon]search.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.icon]search.obj"
$ cc /include_directory=("./include","./src/icon") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.icon]search.obj [.src.icon]search.c
$ endif
$ if f$search("[.src.icon]up.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.icon]up.obj"
$ cc /include_directory=("./include","./src/icon") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.icon]up.obj [.src.icon]up.c
$ endif
$ if f$search("[.src.icon]warning.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.icon]warning.obj"
$ cc /include_directory=("./include","./src/icon") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.icon]warning.obj [.src.icon]warning.c
$ endif
$ if f$search("[.src.abstract]directory.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.abstract]directory.obj"
$ cc /include_directory=("./include","./src/abstract") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.abstract]directory.obj [.src.abstract]directory.c
$ endif
$ if f$search("[.src.abstract]dynamic.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.abstract]dynamic.obj"
$ cc /include_directory=("./include","./src/abstract") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.abstract]dynamic.obj [.src.abstract]dynamic.c
$ endif
$ if f$search("[.src.abstract]time.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.abstract]time.obj"
$ cc /include_directory=("./include","./src/abstract") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.abstract]time.obj [.src.abstract]time.c
$ endif
$ if f$search("[.external]stb_ds.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.external]stb_ds.obj"
$ cc /include_directory=("./include","./external") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.external]stb_ds.obj [.external]stb_ds.c
$ endif
$ if f$search("[.src.backend]x11.obj;*") .eqs. ""
$ then
$ write sys$output "CC [.src.backend]x11.obj"
$ cc /include_directory=("./include","./src/backend") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=[.src.backend]x11.obj [.src.backend]x11.c
$ endif
$ if f$search("[.src]MwSHR.exe;*") .eqs. ""
$ then
$ write sys$output "LINK [.src]MwSHR.exe"
$ OPEN /WRITE LINK_OPT LINK.OPT
$ WRITE LINK_OPT "[.src]color.obj"
$ WRITE LINK_OPT "[.src]core.obj"
$ WRITE LINK_OPT "[.src]default.obj"
$ WRITE LINK_OPT "[.src]draw.obj"
$ WRITE LINK_OPT "[.src]error.obj"
$ WRITE LINK_OPT "[.src]lowlevel.obj"
$ WRITE LINK_OPT "[.src]string.obj"
$ WRITE LINK_OPT "[.src]text.obj"
$ WRITE LINK_OPT "[.src]unicode.obj"
$ WRITE LINK_OPT "[.src.cursor]arrow.obj"
$ WRITE LINK_OPT "[.src.cursor]cross.obj"
$ WRITE LINK_OPT "[.src.cursor]default.obj"
$ WRITE LINK_OPT "[.src.cursor]hidden.obj"
$ WRITE LINK_OPT "[.src.cursor]text.obj"
$ WRITE LINK_OPT "[.src.widget]button.obj"
$ WRITE LINK_OPT "[.src.widget]checkbox.obj"
$ WRITE LINK_OPT "[.src.widget]combobox.obj"
$ WRITE LINK_OPT "[.src.widget]entry.obj"
$ WRITE LINK_OPT "[.src.widget]frame.obj"
$ WRITE LINK_OPT "[.src.widget]image.obj"
$ WRITE LINK_OPT "[.src.widget]label.obj"
$ WRITE LINK_OPT "[.src.widget]listbox.obj"
$ WRITE LINK_OPT "[.src.widget]menu.obj"
$ WRITE LINK_OPT "[.src.widget]numberentry.obj"
$ WRITE LINK_OPT "[.src.widget]progressbar.obj"
$ WRITE LINK_OPT "[.src.widget]radiobox.obj"
$ WRITE LINK_OPT "[.src.widget]scrollbar.obj"
$ WRITE LINK_OPT "[.src.widget]separator.obj"
$ WRITE LINK_OPT "[.src.widget]submenu.obj"
$ WRITE LINK_OPT "[.src.widget]treeview.obj"
$ WRITE LINK_OPT "[.src.widget]viewport.obj"
$ WRITE LINK_OPT "[.src.widget]window.obj"
$ WRITE LINK_OPT "[.src.widget]box.obj"
$ WRITE LINK_OPT "[.src.dialog]colorpicker.obj"
$ WRITE LINK_OPT "[.src.dialog]directorychooser.obj"
$ WRITE LINK_OPT "[.src.dialog]filechooser.obj"
$ WRITE LINK_OPT "[.src.dialog]messagebox.obj"
$ WRITE LINK_OPT "[.src.font]boldfont.obj"
$ WRITE LINK_OPT "[.src.font]boldttf.obj"
$ WRITE LINK_OPT "[.src.font]font.obj"
$ WRITE LINK_OPT "[.src.font]ttf.obj"
$ WRITE LINK_OPT "[.src.icon]back.obj"
$ WRITE LINK_OPT "[.src.icon]clock.obj"
$ WRITE LINK_OPT "[.src.icon]computer.obj"
$ WRITE LINK_OPT "[.src.icon]directory.obj"
$ WRITE LINK_OPT "[.src.icon]down.obj"
$ WRITE LINK_OPT "[.src.icon]error.obj"
$ WRITE LINK_OPT "[.src.icon]file.obj"
$ WRITE LINK_OPT "[.src.icon]forward.obj"
$ WRITE LINK_OPT "[.src.icon]info.obj"
$ WRITE LINK_OPT "[.src.icon]left.obj"
$ WRITE LINK_OPT "[.src.icon]news.obj"
$ WRITE LINK_OPT "[.src.icon]note.obj"
$ WRITE LINK_OPT "[.src.icon]right.obj"
$ WRITE LINK_OPT "[.src.icon]search.obj"
$ WRITE LINK_OPT "[.src.icon]up.obj"
$ WRITE LINK_OPT "[.src.icon]warning.obj"
$ WRITE LINK_OPT "[.src.abstract]directory.obj"
$ WRITE LINK_OPT "[.src.abstract]dynamic.obj"
$ WRITE LINK_OPT "[.src.abstract]time.obj"
$ WRITE LINK_OPT "[.external]stb_ds.obj"
$ WRITE LINK_OPT "[.src.backend]x11.obj"
$ WRITE LINK_OPT "SYS$LIBRARY:DECW$XLIBSHR/SHARE/SHARE"
$ WRITE LINK_OPT "SYS$LIBRARY:DPML$SHR/SHARE/SHARE"
$ CLOSE LINK_OPT
$ link /SHAREABLE=[.src]MwSHR.exe LINK.OPT/options
$ DELETE LINK.OPT;*
$ endif

View File

@@ -1,63 +0,0 @@
$ if f$search("[.src]color.obj") .nes. "" then delete [.src]color.obj;*
$ if f$search("[.src]core.obj") .nes. "" then delete [.src]core.obj;*
$ if f$search("[.src]default.obj") .nes. "" then delete [.src]default.obj;*
$ if f$search("[.src]draw.obj") .nes. "" then delete [.src]draw.obj;*
$ if f$search("[.src]error.obj") .nes. "" then delete [.src]error.obj;*
$ if f$search("[.src]lowlevel.obj") .nes. "" then delete [.src]lowlevel.obj;*
$ if f$search("[.src]string.obj") .nes. "" then delete [.src]string.obj;*
$ if f$search("[.src]text.obj") .nes. "" then delete [.src]text.obj;*
$ if f$search("[.src]unicode.obj") .nes. "" then delete [.src]unicode.obj;*
$ if f$search("[.src.cursor]arrow.obj") .nes. "" then delete [.src.cursor]arrow.obj;*
$ if f$search("[.src.cursor]cross.obj") .nes. "" then delete [.src.cursor]cross.obj;*
$ if f$search("[.src.cursor]default.obj") .nes. "" then delete [.src.cursor]default.obj;*
$ if f$search("[.src.cursor]hidden.obj") .nes. "" then delete [.src.cursor]hidden.obj;*
$ if f$search("[.src.cursor]text.obj") .nes. "" then delete [.src.cursor]text.obj;*
$ if f$search("[.src.widget]button.obj") .nes. "" then delete [.src.widget]button.obj;*
$ if f$search("[.src.widget]checkbox.obj") .nes. "" then delete [.src.widget]checkbox.obj;*
$ if f$search("[.src.widget]combobox.obj") .nes. "" then delete [.src.widget]combobox.obj;*
$ if f$search("[.src.widget]entry.obj") .nes. "" then delete [.src.widget]entry.obj;*
$ if f$search("[.src.widget]frame.obj") .nes. "" then delete [.src.widget]frame.obj;*
$ if f$search("[.src.widget]image.obj") .nes. "" then delete [.src.widget]image.obj;*
$ if f$search("[.src.widget]label.obj") .nes. "" then delete [.src.widget]label.obj;*
$ if f$search("[.src.widget]listbox.obj") .nes. "" then delete [.src.widget]listbox.obj;*
$ if f$search("[.src.widget]menu.obj") .nes. "" then delete [.src.widget]menu.obj;*
$ if f$search("[.src.widget]numberentry.obj") .nes. "" then delete [.src.widget]numberentry.obj;*
$ if f$search("[.src.widget]progressbar.obj") .nes. "" then delete [.src.widget]progressbar.obj;*
$ if f$search("[.src.widget]radiobox.obj") .nes. "" then delete [.src.widget]radiobox.obj;*
$ if f$search("[.src.widget]scrollbar.obj") .nes. "" then delete [.src.widget]scrollbar.obj;*
$ if f$search("[.src.widget]separator.obj") .nes. "" then delete [.src.widget]separator.obj;*
$ if f$search("[.src.widget]submenu.obj") .nes. "" then delete [.src.widget]submenu.obj;*
$ if f$search("[.src.widget]treeview.obj") .nes. "" then delete [.src.widget]treeview.obj;*
$ if f$search("[.src.widget]viewport.obj") .nes. "" then delete [.src.widget]viewport.obj;*
$ if f$search("[.src.widget]window.obj") .nes. "" then delete [.src.widget]window.obj;*
$ if f$search("[.src.widget]box.obj") .nes. "" then delete [.src.widget]box.obj;*
$ if f$search("[.src.dialog]colorpicker.obj") .nes. "" then delete [.src.dialog]colorpicker.obj;*
$ if f$search("[.src.dialog]directorychooser.obj") .nes. "" then delete [.src.dialog]directorychooser.obj;*
$ if f$search("[.src.dialog]filechooser.obj") .nes. "" then delete [.src.dialog]filechooser.obj;*
$ if f$search("[.src.dialog]messagebox.obj") .nes. "" then delete [.src.dialog]messagebox.obj;*
$ if f$search("[.src.font]boldfont.obj") .nes. "" then delete [.src.font]boldfont.obj;*
$ if f$search("[.src.font]boldttf.obj") .nes. "" then delete [.src.font]boldttf.obj;*
$ if f$search("[.src.font]font.obj") .nes. "" then delete [.src.font]font.obj;*
$ if f$search("[.src.font]ttf.obj") .nes. "" then delete [.src.font]ttf.obj;*
$ if f$search("[.src.icon]back.obj") .nes. "" then delete [.src.icon]back.obj;*
$ if f$search("[.src.icon]clock.obj") .nes. "" then delete [.src.icon]clock.obj;*
$ if f$search("[.src.icon]computer.obj") .nes. "" then delete [.src.icon]computer.obj;*
$ if f$search("[.src.icon]directory.obj") .nes. "" then delete [.src.icon]directory.obj;*
$ if f$search("[.src.icon]down.obj") .nes. "" then delete [.src.icon]down.obj;*
$ if f$search("[.src.icon]error.obj") .nes. "" then delete [.src.icon]error.obj;*
$ if f$search("[.src.icon]file.obj") .nes. "" then delete [.src.icon]file.obj;*
$ if f$search("[.src.icon]forward.obj") .nes. "" then delete [.src.icon]forward.obj;*
$ if f$search("[.src.icon]info.obj") .nes. "" then delete [.src.icon]info.obj;*
$ if f$search("[.src.icon]left.obj") .nes. "" then delete [.src.icon]left.obj;*
$ if f$search("[.src.icon]news.obj") .nes. "" then delete [.src.icon]news.obj;*
$ if f$search("[.src.icon]note.obj") .nes. "" then delete [.src.icon]note.obj;*
$ if f$search("[.src.icon]right.obj") .nes. "" then delete [.src.icon]right.obj;*
$ if f$search("[.src.icon]search.obj") .nes. "" then delete [.src.icon]search.obj;*
$ if f$search("[.src.icon]up.obj") .nes. "" then delete [.src.icon]up.obj;*
$ if f$search("[.src.icon]warning.obj") .nes. "" then delete [.src.icon]warning.obj;*
$ if f$search("[.src.abstract]directory.obj") .nes. "" then delete [.src.abstract]directory.obj;*
$ if f$search("[.src.abstract]dynamic.obj") .nes. "" then delete [.src.abstract]dynamic.obj;*
$ if f$search("[.src.abstract]time.obj") .nes. "" then delete [.src.abstract]time.obj;*
$ if f$search("[.external]stb_ds.obj") .nes. "" then delete [.external]stb_ds.obj;*
$ if f$search("[.src.backend]x11.obj") .nes. "" then delete [.src.backend]x11.obj;*
$ if f$search("[.src]MwSHR.exe") .nes. "" then delete [.src]MwSHR.exe;*