diff --git a/src/kinetic_ui/egl/ku_gl.c b/src/kinetic_ui/egl/ku_gl.c index 989a628..4ef1226 100644 --- a/src/kinetic_ui/egl/ku_gl.c +++ b/src/kinetic_ui/egl/ku_gl.c @@ -261,7 +261,8 @@ void ku_gl_add_textures(mt_vector_t* views, int force) /* did it's size change */ if (view->texture.bitmap->w != coords.w || view->texture.bitmap->h != coords.h || force) { - int success = ku_gl_atlas_put(kugl.atlas, view->id, view->texture.bitmap->w, view->texture.bitmap->h); + view->texture.changed = 1; + int success = ku_gl_atlas_put(kugl.atlas, view->id, view->texture.bitmap->w, view->texture.bitmap->h); if (success < 0) { @@ -290,17 +291,21 @@ void ku_gl_add_textures(mt_vector_t* views, int force) coords = ku_gl_atlas_get(kugl.atlas, view->id); } - /* upload texture */ - glTexSubImage2D( - GL_TEXTURE_2D, - 0, - coords.x, - coords.y, - coords.w, - coords.h, - GL_RGBA, - GL_UNSIGNED_BYTE, - view->texture.bitmap->data); + if (view->texture.changed == 1) + { + view->texture.changed = 0; + /* upload texture */ + glTexSubImage2D( + GL_TEXTURE_2D, + 0, + coords.x, + coords.y, + coords.w, + coords.h, + GL_RGBA, + GL_UNSIGNED_BYTE, + view->texture.bitmap->data); + } } else { diff --git a/src/kinetic_ui/ku_connector_wayland.c b/src/kinetic_ui/ku_connector_wayland.c index f1ac3d2..d5840ac 100644 --- a/src/kinetic_ui/ku_connector_wayland.c +++ b/src/kinetic_ui/ku_connector_wayland.c @@ -128,6 +128,10 @@ struct _wl_window_t struct xdg_surface* xdg_surface; /* window surface */ struct xdg_toplevel* xdg_toplevel; /* window info */ + struct pointer_info pointer; /* pointer state */ + struct zwp_pointer_gesture_pinch_v1* pinch; + struct wl_pointer* wl_pointer; + /* backing buffer for native window */ struct wl_buffer* buffer; /* wl buffer for surface */ @@ -171,7 +175,7 @@ void ku_wayland_delete_window(wl_window_t* info); void ku_wayland_request_frame(wl_window_t* info); void ku_wayland_exit(); -void ku_wayland_toggle_fullscreen(); +void ku_wayland_toggle_fullscreen(wl_window_t* window); void ku_wayland_set_time_event_delay(int ms); #endif @@ -214,12 +218,7 @@ struct wlc_t struct monitor_info** monitors; wl_window_t** windows; - /* TODO remove current monitor */ - - struct monitor_info* monitor; /* current monitor */ - struct keyboard_info keyboard; /* keyboard state */ - struct pointer_info pointer; /* pointer state */ /* time event control */ @@ -461,7 +460,6 @@ static void ku_wayland_layer_surface_configure(void* data, struct zwlr_layer_sur { if (info->width != width || info->height != height) { - printf("RESZE\n"); info->width = width; info->height = height; info->buffer_width = info->width * info->scale; @@ -601,7 +599,7 @@ static void wl_surface_enter(void* userData, struct wl_surface* surface, struct if (monitor->wl_output == output) { - mt_log_debug("output name %s %i %i", monitor->name, monitor->scale, info->scale); + mt_log_debug("output name %s monitor scale %i info scale %i", monitor->name, monitor->scale, info->scale); info->monitor = monitor; info->scale = monitor->scale; @@ -1008,25 +1006,42 @@ static void gesture_pinch_begin(void* data, struct zwp_pointer_gesture_pinch_v1* /* emit_gesture_pinch_event(seat, GDK_TOUCHPAD_GESTURE_PHASE_BEGIN, time, fingers, 0, 0, 1, 0); */ /* seat->gesture_n_fingers = fingers; */ - wlc.pointer.scale = 1.0; + for (int index = 0; index < wlc.window_count; index++) + { + wl_window_t* window = wlc.windows[index]; + + if (window->surface == surface && window->monitor) + { + window->pinch = pinch; + window->pointer.scale = 1.0; + } + } } static void gesture_pinch_update(void* data, struct zwp_pointer_gesture_pinch_v1* pinch, uint32_t time, wl_fixed_t dx, wl_fixed_t dy, wl_fixed_t scale, wl_fixed_t rotation) { /* mt_log_debug("pinch dx %f dy %f scale %f rotation %f", wl_fixed_to_double(dx), wl_fixed_to_double(dy), wl_fixed_to_double(scale), wl_fixed_to_double(rotation)); */ - float delta = wl_fixed_to_double(scale) - wlc.pointer.scale; - wlc.pointer.scale = wl_fixed_to_double(scale); + for (int index = 0; index < wlc.window_count; index++) + { + wl_window_t* window = wlc.windows[index]; - ku_event_t event = init_event(); - event.type = KU_EVENT_PINCH; - event.x = wlc.pointer.px; - event.y = wlc.pointer.py; - event.ratio = delta; - event.ctrl_down = wlc.keyboard.control; - event.shift_down = wlc.keyboard.shift; + if (window->pinch == pinch) + { + float delta = wl_fixed_to_double(scale) - window->pointer.scale; + window->pointer.scale = wl_fixed_to_double(scale); - (*wlc.update)(event); + ku_event_t event = init_event(); + event.type = KU_EVENT_PINCH; + event.x = window->pointer.px; + event.y = window->pointer.py; + event.ratio = delta; + event.ctrl_down = wlc.keyboard.control; + event.shift_down = wlc.keyboard.shift; + + (*wlc.update)(event); + } + } } static void gesture_pinch_end(void* data, struct zwp_pointer_gesture_pinch_v1* pinch, uint32_t serial, uint32_t time, int32_t cancelled) @@ -1043,8 +1058,7 @@ static const struct zwp_pointer_gesture_pinch_v1_listener gesture_pinch_listener void ku_wayland_pointer_handle_enter(void* data, struct wl_pointer* wl_pointer, uint serial, struct wl_surface* surface, wl_fixed_t surface_x, wl_fixed_t surface_y) { - /* mt_log_debug("pointer handle enter"); */ - /* TODO assign pointer to surface and dispatch to corresponding window/layer */ + /* mt_log_debug("pointer handle enter %zu", (size_t) wl_pointer); */ struct wl_buffer* buffer; struct wl_cursor* cursor = wlc.default_cursor; @@ -1065,19 +1079,21 @@ void ku_wayland_pointer_handle_enter(void* data, struct wl_pointer* wl_pointer, { wl_window_t* window = wlc.windows[index]; - if (window->surface == surface) + if (window->surface == surface && window->monitor) { + window->wl_pointer = wl_pointer; + ku_event_t event = init_event(); event.type = KU_EVENT_MOUSE_MOVE; - event.drag = wlc.pointer.drag; - event.x = (int) wl_fixed_to_double(surface_x) * wlc.monitor->scale; - event.y = (int) wl_fixed_to_double(surface_y) * wlc.monitor->scale; + event.drag = window->pointer.drag; + event.x = (int) wl_fixed_to_double(surface_x) * window->monitor->scale; + event.y = (int) wl_fixed_to_double(surface_y) * window->monitor->scale; event.ctrl_down = wlc.keyboard.control; event.shift_down = wlc.keyboard.shift; event.window = (void*) window; - wlc.pointer.px = event.x; - wlc.pointer.py = event.y; + window->pointer.px = event.x; + window->pointer.py = event.y; (*wlc.update)(event); } @@ -1086,7 +1102,7 @@ void ku_wayland_pointer_handle_enter(void* data, struct wl_pointer* wl_pointer, void ku_wayland_pointer_handle_leave(void* data, struct wl_pointer* wl_pointer, uint serial, struct wl_surface* surface) { - /* mt_log_debug("pointer handle leave"); */ + /* mt_log_debug("pointer handle leave %zu", (size_t) wl_pointer); */ for (int index = 0; index < wlc.window_count; index++) { @@ -1096,15 +1112,15 @@ void ku_wayland_pointer_handle_leave(void* data, struct wl_pointer* wl_pointer, { ku_event_t event = init_event(); event.type = KU_EVENT_MOUSE_MOVE; - event.drag = wlc.pointer.drag; + event.drag = window->pointer.drag; event.x = -100; event.y = -100; event.ctrl_down = wlc.keyboard.control; event.shift_down = wlc.keyboard.shift; event.window = (void*) window; - wlc.pointer.px = event.x; - wlc.pointer.py = event.y; + window->pointer.px = event.x; + window->pointer.py = event.y; (*wlc.update)(event); } @@ -1113,69 +1129,95 @@ void ku_wayland_pointer_handle_leave(void* data, struct wl_pointer* wl_pointer, void ku_wayland_pointer_handle_motion(void* data, struct wl_pointer* wl_pointer, uint time, wl_fixed_t surface_x, wl_fixed_t surface_y) { - /* mt_log_debug("pointer handle motion %f %f", wl_fixed_to_double(surface_x), wl_fixed_to_double(surface_y)); */ + /* mt_log_debug("pointer handle motion %zu %f %f", (size_t) wl_pointer, wl_fixed_to_double(surface_x), wl_fixed_to_double(surface_y)); */ - wlc.pointer.drag = wlc.pointer.down; + for (int index = 0; index < wlc.window_count; index++) + { + wl_window_t* window = wlc.windows[index]; - ku_event_t event = init_event(); - event.type = KU_EVENT_MOUSE_MOVE; - event.drag = wlc.pointer.drag; - event.x = (int) wl_fixed_to_double(surface_x) * wlc.monitor->scale; - event.y = (int) wl_fixed_to_double(surface_y) * wlc.monitor->scale; - event.ctrl_down = wlc.keyboard.control; - event.shift_down = wlc.keyboard.shift; + if (window->wl_pointer == wl_pointer && window->monitor) + { + window->pointer.drag = window->pointer.down; + + ku_event_t event = init_event(); + event.type = KU_EVENT_MOUSE_MOVE; + event.drag = window->pointer.drag; + event.x = (int) wl_fixed_to_double(surface_x) * window->monitor->scale; + event.y = (int) wl_fixed_to_double(surface_y) * window->monitor->scale; + event.ctrl_down = wlc.keyboard.control; + event.shift_down = wlc.keyboard.shift; - wlc.pointer.px = event.x; - wlc.pointer.py = event.y; + window->pointer.px = event.x; + window->pointer.py = event.y; - (*wlc.update)(event); + (*wlc.update)(event); + } + } } void ku_wayland_pointer_handle_button(void* data, struct wl_pointer* wl_pointer, uint serial, uint time, uint button, uint state) { /* mt_log_debug("pointer handle button %u state %u time %u", button, state, time); */ - ku_event_t event = init_event(); - event.x = wlc.pointer.px; - event.y = wlc.pointer.py; - event.button = button == 272 ? 1 : 3; - event.ctrl_down = wlc.keyboard.control; - event.shift_down = wlc.keyboard.shift; - - if (state) + for (int index = 0; index < wlc.window_count; index++) { - uint delay = time - wlc.pointer.lastdown; - wlc.pointer.lastdown = time; + wl_window_t* window = wlc.windows[index]; - event.dclick = delay < 300; - event.type = KU_EVENT_MOUSE_DOWN; - wlc.pointer.down = 1; - } - else - { - event.type = KU_EVENT_MOUSE_UP; - event.drag = wlc.pointer.drag; - wlc.pointer.drag = 0; - wlc.pointer.down = 0; - } + if (window->wl_pointer == wl_pointer) + { + window->pointer.drag = window->pointer.down; - (*wlc.update)(event); + ku_event_t event = init_event(); + event.x = window->pointer.px; + event.y = window->pointer.py; + event.button = button == 272 ? 1 : 3; + event.ctrl_down = wlc.keyboard.control; + event.shift_down = wlc.keyboard.shift; + + if (state) + { + uint delay = time - window->pointer.lastdown; + window->pointer.lastdown = time; + + event.dclick = delay < 300; + event.type = KU_EVENT_MOUSE_DOWN; + window->pointer.down = 1; + } + else + { + event.type = KU_EVENT_MOUSE_UP; + event.drag = window->pointer.drag; + window->pointer.drag = 0; + window->pointer.down = 0; + } + + (*wlc.update)(event); + } + } } void ku_wayland_pointer_handle_axis(void* data, struct wl_pointer* wl_pointer, uint time, uint axis, wl_fixed_t value) { /* mt_log_debug("pointer handle axis %u %i", axis, value); */ - ku_event_t event = init_event(); - event.type = KU_EVENT_SCROLL; - event.x = wlc.pointer.px; - event.y = wlc.pointer.py; - event.dx = axis == 1 ? (float) value / 200.0 : 0; - event.dy = axis == 0 ? (float) -value / 200.0 : 0; - event.ctrl_down = wlc.keyboard.control; - event.shift_down = wlc.keyboard.shift; + for (int index = 0; index < wlc.window_count; index++) + { + wl_window_t* window = wlc.windows[index]; - (*wlc.update)(event); + if (window->wl_pointer == wl_pointer) + { + ku_event_t event = init_event(); + event.type = KU_EVENT_SCROLL; + event.x = window->pointer.px; + event.y = window->pointer.py; + event.dx = axis == 1 ? (float) value / 200.0 : 0; + event.dy = axis == 0 ? (float) -value / 200.0 : 0; + event.ctrl_down = wlc.keyboard.control; + event.shift_down = wlc.keyboard.shift; + + (*wlc.update)(event); + } + } } void ku_wayland_pointer_handle_frame(void* data, struct wl_pointer* wl_pointer) @@ -1669,9 +1711,6 @@ void ku_wayland_init( (*wlc.init)(event); - /* TODO remove this after binding pointer events to surfaces */ - wlc.monitor = wlc.monitors[0]; - /* file descriptors */ struct pollfd fds[] = { {.fd = wl_display_get_fd(wlc.display), .events = POLLIN}, @@ -1775,19 +1814,18 @@ void ku_wayland_exit() } /* request fullscreen */ -/* TODO connect this with the corresponding window */ -void ku_wayland_toggle_fullscreen() +void ku_wayland_toggle_fullscreen(wl_window_t* window) { if (wlc.windows[0]->fullscreen == 0) { - xdg_toplevel_set_fullscreen(wlc.windows[0]->xdg_toplevel, wlc.monitor->wl_output); - wlc.windows[0]->fullscreen = 1; + xdg_toplevel_set_fullscreen(window->xdg_toplevel, window->monitor->wl_output); + window->fullscreen = 1; } else { - xdg_toplevel_unset_fullscreen(wlc.windows[0]->xdg_toplevel); - wlc.windows[0]->fullscreen = 0; + xdg_toplevel_unset_fullscreen(window->xdg_toplevel); + window->fullscreen = 0; } wl_display_flush(wlc.display); } diff --git a/src/kinetic_ui/ku_css.c b/src/kinetic_ui/ku_css.c index 84e435a..da00dfd 100644 --- a/src/kinetic_ui/ku_css.c +++ b/src/kinetic_ui/ku_css.c @@ -8,6 +8,7 @@ /* TODO write tests */ +#include "mt_log.c" #include "mt_map.c" #include "mt_string.c" #include "mt_vector.c" @@ -119,38 +120,43 @@ prop_t* ku_css_new_parse(char* css) mt_map_t* ku_css_new(char* filepath) { - char* css = mt_string_new_file(filepath); // REL 0 - prop_t* view_styles = ku_css_new_parse(css); // REL 1 - mt_map_t* styles = MNEW(); // REL 2 - prop_t* props = view_styles; + mt_map_t* styles = MNEW(); // REL 2 + char* css = mt_string_new_file(filepath); // REL 0 - while ((*props).class.len > 0) + if (css) { - prop_t t = *props; - char* cls = CAL(sizeof(char) * t.class.len + 1, NULL, mt_string_describe); // REL 3 - char* key = CAL(sizeof(char) * t.key.len + 1, NULL, mt_string_describe); // REL 4 - char* val = CAL(sizeof(char) * t.value.len + 1, NULL, mt_string_describe); // REL 5 + prop_t* view_styles = ku_css_new_parse(css); // REL 1 + prop_t* props = view_styles; - memcpy(cls, css + t.class.pos, t.class.len); - memcpy(key, css + t.key.pos, t.key.len); - memcpy(val, css + t.value.pos, t.value.len); - - mt_map_t* style = MGET(styles, cls); - if (style == NULL) + while ((*props).class.len > 0) { - style = MNEW(); // REL 6 - MPUT(styles, cls, style); - REL(style); // REL 6 + prop_t t = *props; + char* cls = CAL(sizeof(char) * t.class.len + 1, NULL, mt_string_describe); // REL 3 + char* key = CAL(sizeof(char) * t.key.len + 1, NULL, mt_string_describe); // REL 4 + char* val = CAL(sizeof(char) * t.value.len + 1, NULL, mt_string_describe); // REL 5 + + memcpy(cls, css + t.class.pos, t.class.len); + memcpy(key, css + t.key.pos, t.key.len); + memcpy(val, css + t.value.pos, t.value.len); + + mt_map_t* style = MGET(styles, cls); + if (style == NULL) + { + style = MNEW(); // REL 6 + MPUT(styles, cls, style); + REL(style); // REL 6 + } + MPUT(style, key, val); + props += 1; + REL(cls); // REL 3 + REL(key); // REL 4 + REL(val); // REL 5 } - MPUT(style, key, val); - props += 1; - REL(cls); // REL 3 - REL(key); // REL 4 - REL(val); // REL 5 - } - REL(view_styles); - REL(css); + REL(view_styles); + REL(css); + } + else mt_log_error("Empty CSS descriptor"); return styles; } diff --git a/src/kinetic_ui/ku_fontconfig.c b/src/kinetic_ui/ku_fontconfig.c index 54b4954..e1a0e70 100644 --- a/src/kinetic_ui/ku_fontconfig.c +++ b/src/kinetic_ui/ku_fontconfig.c @@ -46,6 +46,7 @@ char* ku_fontconfig_path(char* face_desc) void ku_fontconfig_delete() { if (ku_fontconfig_cache) REL(ku_fontconfig_cache); + ku_fontconfig_cache = NULL; } #endif diff --git a/src/kinetic_ui/ku_gen_html.c b/src/kinetic_ui/ku_gen_html.c index e4ac7f7..95cbb31 100644 --- a/src/kinetic_ui/ku_gen_html.c +++ b/src/kinetic_ui/ku_gen_html.c @@ -11,89 +11,95 @@ void ku_gen_html_parse(char* htmlpath, mt_vector_t* views); #include "ku_html.c" #include "ku_view.c" +#include "mt_log.c" #include "mt_string_ext.c" void ku_gen_html_parse(char* htmlpath, mt_vector_t* views) { - char* html = mt_string_new_file(htmlpath); // REL 0 - tag_t* tags = ku_html_new(html); // REL 1 - tag_t* head = tags; + char* html = mt_string_new_file(htmlpath); // REL 0 - while ((*tags).len > 0) + if (html != NULL) { - tag_t t = *tags; - if (t.id.len > 0) - { - // extract id - char* id = CAL(sizeof(char) * t.id.len + 1, NULL, mt_string_describe); // REL 0 - memcpy(id, html + t.id.pos + 1, t.id.len); - ku_view_t* view = ku_view_new(id, (ku_rect_t){0}); // REL 1 - - if (t.level > 0) - { - // add to parent - ku_view_t* parent = views->data[t.parent]; - ku_view_add_subview(parent, view); - } - - if (t.class.len > 0) - { - // store css classes - char* class = CAL(sizeof(char) * t.class.len + 1, NULL, mt_string_describe); // REL 0 - memcpy(class, html + t.class.pos + 1, t.class.len); - ku_view_set_class(view, class); - REL(class); - } - - if (t.type.len > 0) - { - // store html stype - char* type = CAL(sizeof(char) * t.type.len + 1, NULL, mt_string_describe); // REL 2 - memcpy(type, html + t.type.pos + 1, t.type.len); - ku_view_set_type(view, type); - REL(type); // REL 2 - } + tag_t* tags = ku_html_new(html); // REL 1 + tag_t* head = tags; - if (t.text.len > 0) + while ((*tags).len > 0) + { + tag_t t = *tags; + if (t.id.len > 0) { - // store html stype - char* text = CAL(sizeof(char) * t.text.len + 1, NULL, mt_string_describe); // REL 2 - memcpy(text, html + t.text.pos + 1, t.text.len); - ku_view_set_text(view, text); - REL(text); // REL 2 + // extract id + char* id = CAL(sizeof(char) * t.id.len + 1, NULL, mt_string_describe); // REL 0 + memcpy(id, html + t.id.pos + 1, t.id.len); + ku_view_t* view = ku_view_new(id, (ku_rect_t){0}); // REL 1 + + if (t.level > 0) + { + // add to parent + ku_view_t* parent = views->data[t.parent]; + ku_view_add_subview(parent, view); + } + + if (t.class.len > 0) + { + // store css classes + char* class = CAL(sizeof(char) * t.class.len + 1, NULL, mt_string_describe); // REL 0 + memcpy(class, html + t.class.pos + 1, t.class.len); + ku_view_set_class(view, class); + REL(class); + } + + if (t.type.len > 0) + { + // store html stype + char* type = CAL(sizeof(char) * t.type.len + 1, NULL, mt_string_describe); // REL 2 + memcpy(type, html + t.type.pos + 1, t.type.len); + ku_view_set_type(view, type); + REL(type); // REL 2 + } + + if (t.text.len > 0) + { + // store html stype + char* text = CAL(sizeof(char) * t.text.len + 1, NULL, mt_string_describe); // REL 2 + memcpy(text, html + t.text.pos + 1, t.text.len); + ku_view_set_text(view, text); + REL(text); // REL 2 + } + + if (t.script.len > 0) + { + // store html stype + char* script = CAL(sizeof(char) * t.script.len + 1, NULL, mt_string_describe); // REL 2 + memcpy(script, html + t.script.pos + 1, t.script.len); + ku_view_set_script(view, script); + REL(script); // REL 2 + } + + VADD(views, view); + + REL(id); // REL 0 + REL(view); // REL 1 } - - if (t.script.len > 0) + else { - // store html stype - char* script = CAL(sizeof(char) * t.script.len + 1, NULL, mt_string_describe); // REL 2 - memcpy(script, html + t.script.pos + 1, t.script.len); - ku_view_set_script(view, script); - REL(script); // REL 2 + static int divcnt = 0; + char* divid = mt_string_new_format(10, "div%i", divcnt++); + // idless view, probably + ku_view_t* view = ku_view_new(divid, (ku_rect_t){0}); + VADD(views, view); + REL(view); + REL(divid); } - - VADD(views, view); - - REL(id); // REL 0 - REL(view); // REL 1 + tags += 1; } - else - { - static int divcnt = 0; - char* divid = mt_string_new_format(10, "div%i", divcnt++); - // idless view, probably - ku_view_t* view = ku_view_new(divid, (ku_rect_t){0}); - VADD(views, view); - REL(view); - REL(divid); - } - tags += 1; - } - // cleanup + // cleanup - REL(head); // REL 1 - REL(html); // REL 0 + REL(head); // REL 1 + REL(html); // REL 0 + } + else mt_log_error("No HTML description"); } #endif diff --git a/src/kinetic_ui/ku_window.c b/src/kinetic_ui/ku_window.c index c9e9804..c4c10c0 100644 --- a/src/kinetic_ui/ku_window.c +++ b/src/kinetic_ui/ku_window.c @@ -330,8 +330,8 @@ ku_rect_t ku_window_update(ku_window_t* win, uint32_t time) if (view->texture.changed) { - result = ku_rect_add(result, view->frame.global); - view->texture.changed = 0; + result = ku_rect_add(result, view->frame.global); + /* view->texture.changed = 0; */ } else if (view->frame.dim_changed) { diff --git a/src/kinetic_ui/texture/tg_knob.c b/src/kinetic_ui/texture/tg_knob.c index 8f42272..4e6c7bd 100644 --- a/src/kinetic_ui/texture/tg_knob.c +++ b/src/kinetic_ui/texture/tg_knob.c @@ -26,6 +26,13 @@ void tg_knob_gen(ku_view_t* view) if (view->frame.local.w > 0 && view->frame.local.h > 0) { + + float dist0 = 5 * view->style.scale; + float dist1 = 27 * view->style.scale; + float dist8 = 28 * view->style.scale; + float dist2 = 31 * view->style.scale; + float dist3 = 35 * view->style.scale; + if (view->texture.bitmap == NULL && view->frame.local.w > 0 && view->frame.local.h > 0) { ku_bitmap_t* bmp = ku_bitmap_new(view->frame.local.w, view->frame.local.h); // REL 0 @@ -47,12 +54,12 @@ void tg_knob_gen(ku_view_t* view) /* 0x00000044, */ /* 0); */ - ku_draw_arc_grad(tg->back, (view->frame.local.w - 1.0) / 2.0, (view->frame.local.h - 1.0) / 2.0, 0, (view->frame.local.w / 2.0) - 5.0, 0, 3.14 * 2, basecol, basecol); - ku_draw_arc_grad(tg->back, (view->frame.local.w - 1.0) / 2.0, (view->frame.local.h - 1.0) / 2.0, 27, 35, 0, 3.14 * 2, outercol, outercol); - ku_draw_arc_grad(tg->back, (view->frame.local.w - 1.0) / 2.0, (view->frame.local.h - 1.0) / 2.0, (view->frame.local.w / 2.0) - 5.0, (view->frame.local.w / 2.0) - 2.0, 0, 3.14 * 2, shadowcol, 0x00000000); + ku_draw_arc_grad(tg->back, (view->frame.local.w - 1.0) / 2.0, (view->frame.local.h - 1.0) / 2.0, 0, (view->frame.local.w / 2.0) - dist0, 0, 3.14 * 2, basecol, basecol); + ku_draw_arc_grad(tg->back, (view->frame.local.w - 1.0) / 2.0, (view->frame.local.h - 1.0) / 2.0, dist1, dist3, 0, 3.14 * 2, outercol, outercol); + ku_draw_arc_grad(tg->back, (view->frame.local.w - 1.0) / 2.0, (view->frame.local.h - 1.0) / 2.0, (view->frame.local.w / 2.0) - dist0, (view->frame.local.w / 2.0) - 2.0, 0, 3.14 * 2, shadowcol, 0x00000000); - ku_draw_arc_grad(tg->fore, (view->frame.local.w - 1.0) / 2.0, (view->frame.local.h - 1.0) / 2.0, 27.0, 31.0, 0, 3.14 * 2, shadowcol, 0); - ku_draw_arc_grad(tg->fore, (view->frame.local.w - 1.0) / 2.0, (view->frame.local.h - 1.0) / 2.0, 0, 28.0, 0, 3.14 * 2, centercol, centercol); + ku_draw_arc_grad(tg->fore, (view->frame.local.w - 1.0) / 2.0, (view->frame.local.h - 1.0) / 2.0, dist1, dist2, 0, 3.14 * 2, shadowcol, 0); + ku_draw_arc_grad(tg->fore, (view->frame.local.w - 1.0) / 2.0, (view->frame.local.h - 1.0) / 2.0, 0, dist8, 0, 3.14 * 2, centercol, centercol); ku_view_set_texture_bmp(view, bmp); REL(bmp); // REL 0 @@ -64,12 +71,12 @@ void tg_knob_gen(ku_view_t* view) if (tg->angle > 3.14 * 3 / 2) { - ku_draw_arc_grad(view->texture.bitmap, (view->frame.local.w - 1.0) / 2.0, (view->frame.local.h - 1.0) / 2.0, 27.0, 35.0, 3.14 * 3 / 2, tg->angle, 0x999999FF, 0x999999FF); + ku_draw_arc_grad(view->texture.bitmap, (view->frame.local.w - 1.0) / 2.0, (view->frame.local.h - 1.0) / 2.0, dist1, dist3, 3.14 * 3 / 2, tg->angle, 0x999999FF, 0x999999FF); } else { - ku_draw_arc_grad(view->texture.bitmap, (view->frame.local.w - 1.0) / 2.0, (view->frame.local.h - 1.0) / 2.0, 27.0, 35.0, 3.14 * 3 / 2, 6.28, 0x999999FF, 0x999999FF); - ku_draw_arc_grad(view->texture.bitmap, (view->frame.local.w - 1.0) / 2.0, (view->frame.local.h - 1.0) / 2.0, 27.0, 35.0, 0, tg->angle, 0x999999FF, 0x999999FF); + ku_draw_arc_grad(view->texture.bitmap, (view->frame.local.w - 1.0) / 2.0, (view->frame.local.h - 1.0) / 2.0, dist1, dist3, 3.14 * 3 / 2, 6.28, 0x999999FF, 0x999999FF); + ku_draw_arc_grad(view->texture.bitmap, (view->frame.local.w - 1.0) / 2.0, (view->frame.local.h - 1.0) / 2.0, dist1, dist3, 0, tg->angle, 0x999999FF, 0x999999FF); } ku_draw_blend_argb(view->texture.bitmap, 0, 0, tg->fore);