From 7aad5f3647bfdb085515ec75e5c5c4a284d91b58 Mon Sep 17 00:00:00 2001 From: Ivan Mahonin Date: Feb 17 2024 18:09:36 +0000 Subject: dock mode for maemo --- diff --git a/app.c b/app.c index 7459a47..239518c 100644 --- a/app.c +++ b/app.c @@ -64,6 +64,13 @@ int appInit(App *app) { XSetWMName(app->dpy, app->win, &wtitle); XFree(wtitle.value); } + #ifdef DOCK + Atom wt = XInternAtom(app->dpy, "_NET_WM_WINDOW_TYPE", False); + //Atom wtval = XInternAtom(app->dpy, "_HILDON_WM_WINDOW_TYPE_REMOTE_TEXTURE", False); + Atom wtval = XInternAtom(app->dpy, "_NET_WM_WINDOW_TYPE_TOOLBAR", False); + if (wt != None && wtval != None) + XChangeProperty(app->dpy, app->win, wt, XA_ATOM, 32, PropModeReplace, (unsigned char*)&wtval, 1); + #endif #endif LOGDBG("app: init: set window minimum size"); @@ -103,7 +110,6 @@ int appInit(App *app) { // subscribe to keyboard state and layout changes XkbSelectEvents(app->dpy, XkbUseCoreKbd, XkbMapNotifyMask | XkbStateNotifyMask, XkbMapNotifyMask | XkbStateNotifyMask); - // init submodules if (graphInit(&app->graph, app)) { graphResize(&app->graph); diff --git a/config.h b/config.h index 6eab52a..0e48a56 100644 --- a/config.h +++ b/config.h @@ -3,7 +3,9 @@ //#define NOBORDER -#define LOCK_SIZE +//#define LOCK_SIZE +//#define DOCK +//#define TOP_RESIZE #define WIDTH_SCALE 1/1 // (nominator)/(denomitator) #define HEIGHT_SCALE 1/3 diff --git a/keyboard.c b/keyboard.c index f784209..5bea302 100644 --- a/keyboard.c +++ b/keyboard.c @@ -100,8 +100,12 @@ void keyDown(Key *k, int x, int y) { k->my = y; } else if (k->flags & KF_SIZE) { + #ifdef TOP_RESIZE + k->my = y; + #else k->mx = kbd->app->w - x; k->my = kbd->app->h - y; + #endif } if (k->flags & KF_HOLD) { @@ -137,7 +141,11 @@ void keyMotion(Key *k, int x, int y) { appMove(app, app->x + x - k->mx, app->y + y - k->my, app->w, app->h); } else if (k->flags & KF_SIZE) { + #ifdef TOP_RESIZE + appMove(app, app->x, app->y - k->my + y, app->w, app->h + k->my - y); + #else appMove(app, app->x, app->y, x + k->mx, y + k->my); + #endif } } diff --git a/layout.defs.h b/layout.defs.h index 7c7318f..76887a7 100644 --- a/layout.defs.h +++ b/layout.defs.h @@ -26,7 +26,7 @@ #define FW (12*W+11*S) // full width -#ifdef NOBORDER +#if defined(NOBORDER) #define HH 30 // header height #define HEADER(fw) \ { X0, Y0, fw-S-HH, HH, 0, 0, "::: coolkbd :::", "", KF_MOVE }, \ @@ -38,6 +38,12 @@ { X0, N2, fw, HH, 0, 0, "::: resize handle :::", "", KF_SIZE }, #endif #define Y1 (Y0+HH+S2) +#elif defined(TOP_RESIZE) && !defined(LOCK_SIZE) + #define HH 30 // header height + #define HEADER(fw) \ + { X0, Y0, fw, HH, 0, 0, "::: resize handle :::", "", KF_SIZE }, + #define FOOTER(fw) + #define Y1 (Y0+HH+S2) #else #define Y1 Y0 #define HEADER(fw)