forked from pyrite-dev/milsko
wayland
This commit is contained in:
parent
ad49a55812
commit
bf5ab45f2e
6 changed files with 57 additions and 5 deletions
39
examples/basic/tab.c
Normal file
39
examples/basic/tab.c
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
#include <Mw/Milsko.h>
|
||||
|
||||
MwWidget tab;
|
||||
|
||||
static void MWAPI resize(MwWidget handle, void* user, void* client) {
|
||||
MwVaApply(tab,
|
||||
MwNwidth, MwGetInteger(handle, MwNwidth),
|
||||
MwNheight, MwGetInteger(handle, MwNheight),
|
||||
NULL);
|
||||
}
|
||||
|
||||
int main() {
|
||||
MwWidget w;
|
||||
int i;
|
||||
MwLLPixmap px[6];
|
||||
|
||||
MwLibraryInit();
|
||||
|
||||
w = MwVaCreateWidget(MwWindowClass, "main", NULL, MwDEFAULT, MwDEFAULT, 800, 600,
|
||||
MwNtitle, "subwindow",
|
||||
NULL);
|
||||
|
||||
tab = MwCreateWidget(MwTabClass, "tab", w, 0, 0, 800, 600);
|
||||
|
||||
for(i = 0; i < 16; i++) {
|
||||
char buf[32];
|
||||
MwWidget sw, f, img;
|
||||
|
||||
sprintf(buf, "Tab %d", i);
|
||||
|
||||
MwTabAdd(tab, buf);
|
||||
}
|
||||
|
||||
MwAddUserHandler(w, MwNresizeHandler, resize, NULL);
|
||||
|
||||
resize(w, NULL, NULL);
|
||||
|
||||
MwLoop(w);
|
||||
}
|
||||
|
|
@ -446,6 +446,9 @@ struct _MwLLWayland {
|
|||
|
||||
MwBool is_toplevel;
|
||||
|
||||
MwBool is_clipping;
|
||||
MwRect clip;
|
||||
|
||||
/* Map of Wayland interfaces to their relevant setup functions. */
|
||||
struct {
|
||||
char* key;
|
||||
|
|
|
|||
|
|
@ -201,6 +201,7 @@ new_example("examples/basic/calculator");
|
|||
new_example("examples/basic/filechooser");
|
||||
new_example("examples/basic/periodic");
|
||||
new_example("examples/basic/subwindow");
|
||||
new_example("examples/basic/tab");
|
||||
|
||||
if (param_get("opengl")) {
|
||||
new_example("examples/gldemos/boing", $gl_libs);
|
||||
|
|
|
|||
|
|
@ -591,6 +591,11 @@ static void clip(MwLL handle) {
|
|||
cairo_rectangle(handle->wayland.front_cairo, cx - x, cy - y, mx - cx, my - cy);
|
||||
cairo_clip(handle->wayland.front_cairo);
|
||||
}
|
||||
|
||||
if(handle->wayland.is_clipping){
|
||||
cairo_rectangle(handle->wayland.front_cairo, handle->wayland.clip.x, handle->wayland.clip.y, handle->wayland.clip.width, handle->wayland.clip.height);
|
||||
cairo_clip(handle->wayland.front_cairo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -700,6 +705,7 @@ static MwLL MwLLCreateImpl(MwLL parent, int x, int y, int width, int height) {
|
|||
}
|
||||
|
||||
r->wayland.is_toplevel = parent == NULL;
|
||||
r->wayland.is_clipping = 0;
|
||||
|
||||
widget_setup(r, parent, x, y, width, height, MwLL_WAYLAND_UNKNOWN);
|
||||
|
||||
|
|
@ -1597,8 +1603,11 @@ static void MwLLRaiseImpl(MwLL handle) {
|
|||
}
|
||||
|
||||
static void MwLLClipImpl(MwLL handle, MwRect* rect) {
|
||||
(void)handle;
|
||||
(void)rect;
|
||||
if(rect == NULL){
|
||||
handle->wayland.is_clipping = MwFALSE;
|
||||
}else{
|
||||
handle->wayland.clip = *rect;
|
||||
}
|
||||
}
|
||||
|
||||
static int MwLLWaylandCallInitImpl(void) {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ int MwDefaultBorderWidth(MwWidget handle) {
|
|||
if(bw != MwDEFAULT) return bw;
|
||||
|
||||
if(MwGetInteger(handle, MwNmodernLook)) {
|
||||
return 1;
|
||||
return 2;
|
||||
} else {
|
||||
return 2;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -359,13 +359,13 @@ static void MwDrawFrameEx_complex(MwWidget handle, MwRect* rect, MwLLColor color
|
|||
MwLLColor lighter = same ? MwLightenColor(handle, darker, 0, 0, 0) : MwLightenColor(handle, color, (ColorDiff / 2) - diff, (ColorDiff / 2) - diff, (ColorDiff / 2) - diff);
|
||||
MwRect r = *rect;
|
||||
|
||||
frame_border_complex(handle, rect, lighter, darker, invert, border, diff, same);
|
||||
frame_border_complex(handle, rect, lighter, darker, invert, border / 2, diff, same);
|
||||
|
||||
r.x += 1;
|
||||
r.y += 1;
|
||||
r.width -= 2;
|
||||
r.height -= 2;
|
||||
frame_border_complex(handle, &r, lighter, darker, !invert, border, diff, same);
|
||||
frame_border_complex(handle, &r, lighter, darker, !invert, border / 2, diff, same);
|
||||
|
||||
MwLLFreeColor(lighter);
|
||||
MwLLFreeColor(darker);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue