Port old (C) panel
5
Makefile
@ -1,4 +1,4 @@
|
||||
APPS=init hello sh ls terminal uname compositor drawlines background session kdebug cat yutani-test sysinfo hostname yutani-query env mount date echo nyancat kill ps pstree bim terminal-vga cursor-off font-server migrate free uptime http-get plasma julia
|
||||
APPS=init hello sh ls terminal uname compositor drawlines background session kdebug cat yutani-test sysinfo hostname yutani-query env mount date echo nyancat kill ps pstree bim terminal-vga cursor-off font-server migrate free uptime http-get plasma julia panel
|
||||
|
||||
ifeq ($(TOOLCHAIN),)
|
||||
ifeq ($(shell util/check.sh),y)
|
||||
@ -194,6 +194,9 @@ base/bin/plasma: apps/plasma.c base/lib/libc.so base/lib/libtoaru_decorations.so
|
||||
base/bin/julia: apps/julia.c base/lib/libc.so base/lib/libtoaru_decorations.so base/lib/libtoaru_graphics.so base/lib/libtoaru_yutani.so base/lib/libtoaru_pthread.so
|
||||
$(CC) $(CFLAGS) -o $@ $< -ltoaru_decorations -ltoaru_dlfcn -ltoaru_yutani -ltoaru_graphics -ltoaru_pex -ltoaru_pthread -ltoaru_hashmap -ltoaru_list $(LIBS)
|
||||
|
||||
base/bin/panel: apps/panel.c base/lib/libc.so base/lib/libtoaru_decorations.so base/lib/libtoaru_graphics.so base/lib/libtoaru_yutani.so base/lib/libtoaru_pthread.so
|
||||
$(CC) $(CFLAGS) -o $@ $< -ltoaru_decorations -ltoaru_drawstring -ltoaru_dlfcn -ltoaru_yutani -ltoaru_graphics -ltoaru_pex -ltoaru_pthread -ltoaru_hashmap -ltoaru_list $(LIBS)
|
||||
|
||||
base/bin/yutani-query: apps/yutani-query.c base/lib/libc.so base/lib/libtoaru_graphics.so base/lib/libtoaru_yutani.so base/lib/libtoaru_pthread.so
|
||||
$(CC) $(CFLAGS) -o $@ $< -ltoaru_yutani -ltoaru_graphics -ltoaru_pex -ltoaru_pthread -ltoaru_hashmap -ltoaru_list $(LIBS)
|
||||
|
||||
|
@ -93,6 +93,7 @@ int main (int argc, char ** argv) {
|
||||
draw_background(yctx->display_width, yctx->display_height);
|
||||
yutani_flip(yctx, wallpaper_window);
|
||||
|
||||
#if 0
|
||||
/* panel */
|
||||
panel_window = yutani_window_create(yctx, yctx->display_width, PANEL_HEIGHT);
|
||||
yutani_window_move(yctx, panel_window, 0, 0);
|
||||
@ -101,6 +102,7 @@ int main (int argc, char ** argv) {
|
||||
panel_ctx = init_graphics_yutani(panel_window);
|
||||
draw_panel(yctx->display_width);
|
||||
yutani_flip(yctx, panel_window);
|
||||
#endif
|
||||
|
||||
int should_exit = 0;
|
||||
|
||||
@ -119,7 +121,9 @@ int main (int argc, char ** argv) {
|
||||
case YUTANI_MSG_WELCOME:
|
||||
fprintf(stderr, "Request to resize desktop received, resizing to %d x %d\n", yctx->display_width, yctx->display_height);
|
||||
yutani_window_resize_offer(yctx, wallpaper_window, yctx->display_width, yctx->display_height);
|
||||
#if 0
|
||||
yutani_window_resize_offer(yctx, panel_window, yctx->display_width, PANEL_HEIGHT);
|
||||
#endif
|
||||
break;
|
||||
case YUTANI_MSG_KEY_EVENT:
|
||||
handle_key_event((struct yutani_msg_key_event *)m->data);
|
||||
@ -129,8 +133,10 @@ int main (int argc, char ** argv) {
|
||||
struct yutani_msg_window_resize * wr = (void*)m->data;
|
||||
if (wr->wid == wallpaper_window->wid) {
|
||||
resize_finish_wallpaper(wr->width, wr->height);
|
||||
#if 0
|
||||
} else if (wr->wid == panel_window->wid) {
|
||||
resize_finish_panel(wr->width, wr->height);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
1154
apps/panel.c
Normal file
@ -14,6 +14,12 @@ int main(int argc, char * argv[]) {
|
||||
execvp(args[0], args);
|
||||
}
|
||||
|
||||
int _panel_pid = fork();
|
||||
if (!_panel_pid) {
|
||||
char * args[] = {"/bin/panel", NULL};
|
||||
execvp(args[0], args);
|
||||
}
|
||||
|
||||
wait(NULL);
|
||||
|
||||
int pid;
|
||||
|
1
base/etc/menu.desktop
Normal file
@ -0,0 +1 @@
|
||||
utilities-terminal,terminal,Terminal
|
@ -10,4 +10,9 @@
|
||||
#define O_NOFOLLOW 0x1000
|
||||
#define O_PATH 0x2000
|
||||
|
||||
#define F_OK 1
|
||||
#define R_OK 4
|
||||
#define W_OK 2
|
||||
#define X_OK 1
|
||||
|
||||
extern int open (const char *, int, ...);
|
||||
|
@ -50,6 +50,7 @@ extern void reinit_graphics_fullscreen(gfx_context_t * ctx);
|
||||
#define ALPHA_MASK 1
|
||||
#define ALPHA_EMBEDDED 2
|
||||
#define ALPHA_INDEXED 3
|
||||
#define ALPHA_FORCE_SLOW_EMBEDDED 4
|
||||
|
||||
extern uint32_t rgb(uint8_t r, uint8_t g, uint8_t b);
|
||||
extern uint32_t rgba(uint8_t r, uint8_t g, uint8_t b, uint8_t a);
|
||||
@ -78,6 +79,7 @@ extern void draw_fill(gfx_context_t * ctx, uint32_t color);
|
||||
extern void draw_sprite_scaled(gfx_context_t * ctx, sprite_t * sprite, int32_t x, int32_t y, uint16_t width, uint16_t height);
|
||||
extern void draw_sprite_scaled_alpha(gfx_context_t * ctx, sprite_t * sprite, int32_t x, int32_t y, uint16_t width, uint16_t height, float alpha);
|
||||
extern void draw_sprite_alpha(gfx_context_t * ctx, sprite_t * sprite, int32_t x, int32_t y, float alpha);
|
||||
extern void draw_sprite_alpha_paint(gfx_context_t * ctx, sprite_t * sprite, int32_t x, int32_t y, float alpha, uint32_t c);
|
||||
|
||||
//extern void context_to_png(FILE * file, gfx_context_t * ctx);
|
||||
|
||||
|
@ -41,6 +41,8 @@ extern int isatty(int fd);
|
||||
extern int usleep(useconds_t usec);
|
||||
extern off_t lseek(int fd, off_t offset, int whence);
|
||||
|
||||
extern int access(const char * pathname, int mode);
|
||||
|
||||
|
||||
#define STDIN_FILENO 0
|
||||
#define STDOUT_FILENO 1
|
||||
|
BIN
base/usr/share/icons/24/applications-generic.bmp
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
base/usr/share/icons/24/utilities-terminal.bmp
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
base/usr/share/icons/24/volume-full.bmp
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
base/usr/share/icons/24/volume-low.bmp
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
base/usr/share/icons/24/volume-medium.bmp
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
base/usr/share/icons/24/volume-mute.bmp
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
base/usr/share/icons/panel-shutdown.bmp
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
base/usr/share/panel.bmp
Normal file
After Width: | Height: | Size: 5.4 KiB |
@ -675,6 +675,19 @@ void draw_sprite(gfx_context_t * ctx, sprite_t * sprite, int32_t x, int32_t y) {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (sprite->alpha == ALPHA_FORCE_SLOW_EMBEDDED) {
|
||||
for (uint16_t _y = 0; _y < sprite->height; ++_y) {
|
||||
if (!_is_in_clip(ctx, y + _y)) continue;
|
||||
for (uint16_t _x = 0; _x < sprite->width; ++_x) {
|
||||
if (x + _x < _left || x + _x > _right || y + _y < _top || y + _y > _bottom)
|
||||
continue;
|
||||
#if 1
|
||||
GFX(ctx, x + _x, y + _y) = alpha_blend_rgba(GFX(ctx, x + _x, y + _y), SPRITE(sprite, _x, _y));
|
||||
#else
|
||||
GFX(ctx, x + _x, y + _y) = alpha_blend_rgba(rgba(255,255,0,255), SPRITE(sprite, _x, _y));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (uint16_t _y = 0; _y < sprite->height; ++_y) {
|
||||
if (!_is_in_clip(ctx, y + _y)) continue;
|
||||
@ -812,6 +825,22 @@ void draw_sprite_alpha(gfx_context_t * ctx, sprite_t * sprite, int32_t x, int32_
|
||||
}
|
||||
}
|
||||
|
||||
void draw_sprite_alpha_paint(gfx_context_t * ctx, sprite_t * sprite, int32_t x, int32_t y, float alpha, uint32_t c) {
|
||||
int32_t _left = max(x, 0);
|
||||
int32_t _top = max(y, 0);
|
||||
int32_t _right = min(x + sprite->width, ctx->width - 1);
|
||||
int32_t _bottom = min(y + sprite->height, ctx->height - 1);
|
||||
for (uint16_t _y = 0; _y < sprite->height; ++_y) {
|
||||
if (!_is_in_clip(ctx, y + _y)) continue;
|
||||
for (uint16_t _x = 0; _x < sprite->width; ++_x) {
|
||||
if (x + _x < _left || x + _x > _right || y + _y < _top || y + _y > _bottom)
|
||||
continue;
|
||||
uint32_t n_color = SPRITE(sprite, _x, _y);
|
||||
uint32_t f_color = rgb(_ALP(n_color) * alpha, 0, 0);
|
||||
GFX(ctx, x + _x, y + _y) = alpha_blend(GFX(ctx, x + _x, y + _y), c, f_color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void draw_sprite_scaled_alpha(gfx_context_t * ctx, sprite_t * sprite, int32_t x, int32_t y, uint16_t width, uint16_t height, float alpha) {
|
||||
int32_t _left = max(x, 0);
|
||||
|
11
libc/access.c
Normal file
@ -0,0 +1,11 @@
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
int access(const char *pathname, int mode) {
|
||||
int result = syscall_access((char *)pathname, mode);
|
||||
if (result < 0) {
|
||||
errno = ENOENT; /* XXX */
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|