|
@@ -113,6 +113,82 @@ static unsigned int bar_clock_w;
|
|
|
static int bar_clock_hot;
|
|
static int bar_clock_hot;
|
|
|
static unsigned int stat_frames, stat_ms, stat_px, stat_max, stat_last;
|
|
static unsigned int stat_frames, stat_ms, stat_px, stat_max, stat_last;
|
|
|
|
|
|
|
|
|
|
+/* ---- Start menu --------------------------------------------------------
|
|
|
|
|
+ * The NebOS banner in the top-left corner is the start button. It opens a
|
|
|
|
|
+ * Windows-like panel drawn by the WM itself (not a window, so it never
|
|
|
|
|
+ * consumes a WM_MAX_WINDOWS slot and floats above every canvas). The panel
|
|
|
|
|
+ * lists every GUI app in the pack and ends with a Power row whose submenu
|
|
|
|
|
+ * reboots or powers off the machine through the privileged kernel command
|
|
|
|
|
+ * registry (SYS_SPAWN_KCMD). */
|
|
|
|
|
+#define SM_W 236
|
|
|
|
|
+#define SM_ROW_H 30
|
|
|
|
|
+#define SM_MIN_ROW 18
|
|
|
|
|
+#define SM_HDR_H 44
|
|
|
|
|
+#define SM_SEP_H 7
|
|
|
|
|
+#define SM_SUB_W 152
|
|
|
|
|
+#define SM_TILE 18
|
|
|
|
|
+
|
|
|
|
|
+#define SM_HIT_NONE (-1)
|
|
|
|
|
+#define SM_HIT_START (-2)
|
|
|
|
|
+#define SM_HIT_POWER (-3)
|
|
|
|
|
+#define SM_HIT_REBOOT (-4)
|
|
|
|
|
+#define SM_HIT_POWEROFF (-5)
|
|
|
|
|
+
|
|
|
|
|
+#define SM_ACT_SPAWN 0
|
|
|
|
|
+#define SM_ACT_TERM 1
|
|
|
|
|
+#define SM_ACT_SETTINGS 2
|
|
|
|
|
+
|
|
|
|
|
+struct sm_app {
|
|
|
|
|
+ const char *label;
|
|
|
|
|
+ const char *path;
|
|
|
|
|
+ const char *arg;
|
|
|
|
|
+ unsigned int tile;
|
|
|
|
|
+ char letter;
|
|
|
|
|
+ unsigned char action;
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+/* Every self-contained GUI application in the pack. Terminal and Settings
|
|
|
|
|
+ * are WM actions (a new terminal canvas and the control panel); edit gets a
|
|
|
|
|
+ * scratch file so it can start without a file argument. */
|
|
|
|
|
+static const struct sm_app sm_apps[] = {
|
|
|
|
|
+ { "Terminal", "", "", 0x3C8CD2u, 'T', SM_ACT_TERM },
|
|
|
|
|
+ { "Files", "/ramfs/bin/files", "", 0xE0A030u, 'F', SM_ACT_SPAWN },
|
|
|
|
|
+ { "Web", "/ramfs/bin/browser", "", 0x4CA0E0u, 'W', SM_ACT_SPAWN },
|
|
|
|
|
+ { "Gallery", "/ramfs/bin/gallery", "", 0xC864B4u, 'G', SM_ACT_SPAWN },
|
|
|
|
|
+ { "Chat", "/ramfs/bin/chat", "", 0x55A055u, 'C', SM_ACT_SPAWN },
|
|
|
|
|
+ { "Clock", "/ramfs/bin/clock", "", 0x8C8C9Cu, 'C', SM_ACT_SPAWN },
|
|
|
|
|
+ { "Text editor", "/ramfs/bin/edit", "/share/UNTITLED.TXT", 0xD27850u, 'E', SM_ACT_SPAWN },
|
|
|
|
|
+ { "Colors", "/ramfs/bin/colors", "", 0xC85A5Au, 'P', SM_ACT_SPAWN },
|
|
|
|
|
+ { "Mines", "/ramfs/bin/mines", "", 0x8C6CD2u, 'M', SM_ACT_SPAWN },
|
|
|
|
|
+ { "Cards", "/ramfs/bin/solitaire","", 0x3CA08Cu, 'S', SM_ACT_SPAWN },
|
|
|
|
|
+ { "Disks", "/ramfs/bin/disks", "", 0x5A8CC8u, 'D', SM_ACT_SPAWN },
|
|
|
|
|
+ { "Tasks", "/ramfs/bin/process", "", 0xE0B040u, 'P', SM_ACT_SPAWN },
|
|
|
|
|
+ { "Settings", "", "", 0x7A7A9Au, 'S', SM_ACT_SETTINGS },
|
|
|
|
|
+ { "Date & Time", "/ramfs/bin/settime", "", 0x5AA0A0u, 'D', SM_ACT_SPAWN },
|
|
|
|
|
+};
|
|
|
|
|
+#define SM_NAPP ((int)(sizeof(sm_apps) / sizeof(sm_apps[0])))
|
|
|
|
|
+
|
|
|
|
|
+struct sm_layout {
|
|
|
|
|
+ int x, y, w, h;
|
|
|
|
|
+ int row_h;
|
|
|
|
|
+ int list_y;
|
|
|
|
|
+ int power_y;
|
|
|
|
|
+ int sub_x, sub_y, sub_w, sub_h;
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+static int sm_open;
|
|
|
|
|
+static int sm_power_open;
|
|
|
|
|
+static int sm_start_hot;
|
|
|
|
|
+static int sm_hot; /* hovered app index, -1 = none */
|
|
|
|
|
+static int sm_power_hot; /* 0 none, 1 Power, 2 Reboot, 3 Power off */
|
|
|
|
|
+
|
|
|
|
|
+static void sm_layout_get(struct sm_layout *l);
|
|
|
|
|
+static void sm_draw(void);
|
|
|
|
|
+static void sm_add_present(struct wm_present_info *p);
|
|
|
|
|
+static int sm_update_hover(unsigned int mx, unsigned int my);
|
|
|
|
|
+static void sm_close(void);
|
|
|
|
|
+static void sm_launch(int idx);
|
|
|
|
|
+
|
|
|
/* Network status icon (right side of the bar). */
|
|
/* Network status icon (right side of the bar). */
|
|
|
#define BAR_NET_W 24
|
|
#define BAR_NET_W 24
|
|
|
#define BAR_NET_Y 7
|
|
#define BAR_NET_Y 7
|
|
@@ -208,14 +284,39 @@ static void fill_clip(int x, int y, unsigned int w, unsigned int h,
|
|
|
(unsigned int)(y1 - y0), rgb);
|
|
(unsigned int)(y1 - y0), rgb);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-static void bar_button(unsigned int x, unsigned int y, unsigned int w,
|
|
|
|
|
- unsigned int h, const char *label)
|
|
|
|
|
|
|
+/* The NebOS banner doubles as the start button. Its width follows the
|
|
|
|
|
+ * proportional font, so the hit area and the highlight use the same
|
|
|
|
|
+ * geometry. */
|
|
|
|
|
+static void bar_start_geom(int *x, int *y, int *w, int *h)
|
|
|
|
|
+{
|
|
|
|
|
+ *x = 2;
|
|
|
|
|
+ *y = 2;
|
|
|
|
|
+ *h = WM_BAR_H - 6;
|
|
|
|
|
+ *w = (int)usurf_text_width(&screen, OS_NAME " v" OS_VERSION) + 20;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static int bar_start_hit(unsigned int mx, unsigned int my)
|
|
|
|
|
+{
|
|
|
|
|
+ int x, y, w, h;
|
|
|
|
|
+
|
|
|
|
|
+ bar_start_geom(&x, &y, &w, &h);
|
|
|
|
|
+ return (int)mx >= x && (int)mx < x + w &&
|
|
|
|
|
+ (int)my >= y && (int)my < y + h;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static void bar_start_button(void)
|
|
|
{
|
|
{
|
|
|
- int tw = (int)usurf_text_width(&screen, label);
|
|
|
|
|
|
|
+ int x, y, w, h;
|
|
|
|
|
|
|
|
- usurf_fill(&screen, x, y, w, h, 0x963CD2u);
|
|
|
|
|
- usurf_text(&screen, (int)x + ((int)w - tw) / 2, (int)(y + 3),
|
|
|
|
|
- label, COL_WHITE, 0, 0, fbw, WM_BAR_H);
|
|
|
|
|
|
|
+ bar_start_geom(&x, &y, &w, &h);
|
|
|
|
|
+ if (sm_open || sm_start_hot) {
|
|
|
|
|
+ usurf_fill(&screen, x, y, w, h,
|
|
|
|
|
+ sm_open ? 0x365CA6u : 0x3A3A55u);
|
|
|
|
|
+ usurf_fill(&screen, x + 2, y + h - 2, w - 4, 2,
|
|
|
|
|
+ sm_open ? 0x55FF55u : 0x70709Au);
|
|
|
|
|
+ }
|
|
|
|
|
+ usurf_text(&screen, x + 10, y + 4, OS_NAME " v" OS_VERSION,
|
|
|
|
|
+ sm_open ? COL_WHITE : COL_BANNER, 0, 0, fbw, WM_BAR_H);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
static int name_is(const char *a, const char *b)
|
|
static int name_is(const char *a, const char *b)
|
|
@@ -439,32 +540,10 @@ static void draw_bar(void)
|
|
|
unsigned int n, i, x, y;
|
|
unsigned int n, i, x, y;
|
|
|
|
|
|
|
|
usurf_fill(&screen, 0, 0, fbw, WM_BAR_H, COL_BG);
|
|
usurf_fill(&screen, 0, 0, fbw, WM_BAR_H, COL_BG);
|
|
|
- usurf_text(&screen, 4, 5, OS_NAME " v" OS_VERSION, COL_BANNER,
|
|
|
|
|
- 0, 0, fbw, WM_BAR_H);
|
|
|
|
|
- bar_button(WM_BTN_X, WM_BTN_Y, WM_BTN_W, WM_BTN_H, "New");
|
|
|
|
|
- bar_button(WM_BTN_CLOCK_X, WM_BTN_CLOCK_Y, WM_BTN_CLOCK_W,
|
|
|
|
|
- WM_BTN_CLOCK_H, "Clock");
|
|
|
|
|
- bar_button(WM_BTN_COLORS_X, WM_BTN_COLORS_Y, WM_BTN_COLORS_W,
|
|
|
|
|
- WM_BTN_COLORS_H, "Colors");
|
|
|
|
|
- bar_button(WM_BTN_FILES_X, WM_BTN_FILES_Y, WM_BTN_FILES_W,
|
|
|
|
|
- WM_BTN_FILES_H, "Files");
|
|
|
|
|
- bar_button(WM_BTN_MINES_X, WM_BTN_MINES_Y, WM_BTN_MINES_W,
|
|
|
|
|
- WM_BTN_MINES_H, "Mines");
|
|
|
|
|
- bar_button(WM_BTN_WEB_X, WM_BTN_WEB_Y, WM_BTN_WEB_W,
|
|
|
|
|
- WM_BTN_WEB_H, "Web");
|
|
|
|
|
- bar_button(WM_BTN_CARDS_X, WM_BTN_CARDS_Y, WM_BTN_CARDS_W,
|
|
|
|
|
- WM_BTN_CARDS_H, "Cards");
|
|
|
|
|
- bar_button(WM_BTN_GALLERY_X, WM_BTN_GALLERY_Y, WM_BTN_GALLERY_W,
|
|
|
|
|
- WM_BTN_GALLERY_H, "Gallery");
|
|
|
|
|
- bar_button(WM_BTN_CHAT_X, WM_BTN_CHAT_Y, WM_BTN_CHAT_W,
|
|
|
|
|
- WM_BTN_CHAT_H, "Chat");
|
|
|
|
|
- bar_button(WM_BTN_DISKS_X, WM_BTN_DISKS_Y, WM_BTN_DISKS_W,
|
|
|
|
|
- WM_BTN_DISKS_H, "Disks");
|
|
|
|
|
- bar_button(WM_BTN_PROCESS_X, WM_BTN_PROCESS_Y, WM_BTN_PROCESS_W,
|
|
|
|
|
- WM_BTN_PROCESS_H, "Tasks");
|
|
|
|
|
|
|
+ bar_start_button();
|
|
|
if (bar_msg_until &&
|
|
if (bar_msg_until &&
|
|
|
(int)(u_ticks_ms() - bar_msg_until) < 0)
|
|
(int)(u_ticks_ms() - bar_msg_until) < 0)
|
|
|
- usurf_text(&screen, (int)(WM_BTN_END_X + 8),
|
|
|
|
|
|
|
+ usurf_text(&screen, (int)(WM_BAR_LEFT_END + 8),
|
|
|
5, bar_msg, 0xFFD250u, 0, 0, fbw, WM_BAR_H);
|
|
5, bar_msg, 0xFFD250u, 0, 0, fbw, WM_BAR_H);
|
|
|
|
|
|
|
|
/* Rainbow separator (same y as the kernel's old bar). */
|
|
/* Rainbow separator (same y as the kernel's old bar). */
|
|
@@ -501,7 +580,7 @@ static void draw_bar(void)
|
|
|
} else {
|
|
} else {
|
|
|
unsigned int clock_chars = 0;
|
|
unsigned int clock_chars = 0;
|
|
|
int right = (int)fbw - 4;
|
|
int right = (int)fbw - 4;
|
|
|
- int min_x = (int)WM_BTN_END_X + 4;
|
|
|
|
|
|
|
+ int min_x = (int)WM_BAR_LEFT_END + 4;
|
|
|
|
|
|
|
|
bar_clock_x = -1;
|
|
bar_clock_x = -1;
|
|
|
bar_clock_w = 0;
|
|
bar_clock_w = 0;
|
|
@@ -1107,6 +1186,10 @@ static void wm_overlays(struct wm_present_info *p)
|
|
|
osd_draw();
|
|
osd_draw();
|
|
|
add_rect(p, osd_x, osd_y, osd_w, osd_h);
|
|
add_rect(p, osd_x, osd_y, osd_w, osd_h);
|
|
|
}
|
|
}
|
|
|
|
|
+ if (sm_open) {
|
|
|
|
|
+ sm_draw();
|
|
|
|
|
+ sm_add_present(p);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/* A focused window is topmost, so the shadow contains exactly its pixels in
|
|
/* A focused window is topmost, so the shadow contains exactly its pixels in
|
|
@@ -1358,11 +1441,228 @@ static int bar_pwr_hit(unsigned int mx, unsigned int my)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/* The whole right status area is one button: the clock, temperature, network
|
|
/* The whole right status area is one button: the clock, temperature, network
|
|
|
- * and power items plus the gaps between them. The launcher buttons end at
|
|
|
|
|
- * WM_BTN_END_X, so this never overlaps them. */
|
|
|
|
|
|
|
+ * and power items plus the gaps between them. The start button ends well
|
|
|
|
|
+ * before WM_BAR_LEFT_END, so this never overlaps it. */
|
|
|
static int bar_status_hit(unsigned int mx, unsigned int my)
|
|
static int bar_status_hit(unsigned int mx, unsigned int my)
|
|
|
{
|
|
{
|
|
|
- return my < WM_BAR_H && (int)mx >= WM_BTN_END_X + 4;
|
|
|
|
|
|
|
+ return my < WM_BAR_H && (int)mx >= WM_BAR_LEFT_END + 4;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static void sm_layout_get(struct sm_layout *l)
|
|
|
|
|
+{
|
|
|
|
|
+ int avail = (int)fbh - WM_BAR_H - 8;
|
|
|
|
|
+ int row = SM_ROW_H;
|
|
|
|
|
+ int total = SM_HDR_H + SM_NAPP * row + SM_SEP_H + row;
|
|
|
|
|
+
|
|
|
|
|
+ /* Shrink the rows to the work area, so a 540-600 px panel still fits
|
|
|
|
|
+ * the whole list. The low bound is the smallest legible row. */
|
|
|
|
|
+ while (row > SM_MIN_ROW && total > avail) {
|
|
|
|
|
+ row--;
|
|
|
|
|
+ total = SM_HDR_H + SM_NAPP * row + SM_SEP_H + row;
|
|
|
|
|
+ }
|
|
|
|
|
+ l->x = 4;
|
|
|
|
|
+ l->y = WM_BAR_H + 2;
|
|
|
|
|
+ l->w = SM_W;
|
|
|
|
|
+ l->h = total;
|
|
|
|
|
+ l->row_h = row;
|
|
|
|
|
+ l->list_y = l->y + SM_HDR_H;
|
|
|
|
|
+ l->power_y = l->list_y + SM_NAPP * row + SM_SEP_H;
|
|
|
|
|
+
|
|
|
|
|
+ l->sub_w = SM_SUB_W;
|
|
|
|
|
+ l->sub_h = 2 * row + 4;
|
|
|
|
|
+ l->sub_x = l->x + l->w + 2;
|
|
|
|
|
+ if (l->sub_x + l->sub_w > (int)fbw - 2) {
|
|
|
|
|
+ if (l->x - l->sub_w - 2 >= 0)
|
|
|
|
|
+ l->sub_x = l->x - l->sub_w - 2;
|
|
|
|
|
+ else
|
|
|
|
|
+ l->sub_x = (int)fbw - 2 - l->sub_w;
|
|
|
|
|
+ }
|
|
|
|
|
+ /* The power row is the last menu row: open the submenu upwards and
|
|
|
|
|
+ * align its bottom with that row. */
|
|
|
|
|
+ l->sub_y = l->power_y + row - l->sub_h;
|
|
|
|
|
+ if (l->sub_y < WM_BAR_H + 2)
|
|
|
|
|
+ l->sub_y = WM_BAR_H + 2;
|
|
|
|
|
+ if (l->sub_y + l->sub_h > (int)fbh - 2)
|
|
|
|
|
+ l->sub_y = (int)fbh - 2 - l->sub_h;
|
|
|
|
|
+ if (l->sub_y < 0)
|
|
|
|
|
+ l->sub_y = 0;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static void sm_frame(int x, int y, int w, int h)
|
|
|
|
|
+{
|
|
|
|
|
+ usurf_fill(&screen, x, y, (unsigned int)w, (unsigned int)h, 0x161622u);
|
|
|
|
|
+ usurf_fill(&screen, x, y, (unsigned int)w, 1, 0x5A5A7Au);
|
|
|
|
|
+ usurf_fill(&screen, x, y + h - 1, (unsigned int)w, 1, 0x5A5A7Au);
|
|
|
|
|
+ usurf_fill(&screen, x, y, 1, (unsigned int)h, 0x5A5A7Au);
|
|
|
|
|
+ usurf_fill(&screen, x + w - 1, y, 1, (unsigned int)h, 0x5A5A7Au);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static void sm_tile(int x, int y, int size, unsigned int rgb, char letter)
|
|
|
|
|
+{
|
|
|
|
|
+ char s[2];
|
|
|
|
|
+ int tw, tx, ty;
|
|
|
|
|
+
|
|
|
|
|
+ if (size < 12)
|
|
|
|
|
+ size = 12;
|
|
|
|
|
+ s[0] = letter;
|
|
|
|
|
+ s[1] = '\0';
|
|
|
|
|
+ usurf_fill(&screen, x, y, (unsigned int)size, (unsigned int)size, rgb);
|
|
|
|
|
+ tw = (int)usurf_text_width(&screen, s);
|
|
|
|
|
+ tx = x + (size - tw) / 2;
|
|
|
|
|
+ ty = y + (size - 16) / 2;
|
|
|
|
|
+ usurf_text(&screen, tx, ty, s, COL_WHITE,
|
|
|
|
|
+ x, y, (unsigned int)size, (unsigned int)size);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static void sm_draw_app(int i, const struct sm_layout *l)
|
|
|
|
|
+{
|
|
|
|
|
+ const struct sm_app *a = &sm_apps[i];
|
|
|
|
|
+ int ry = l->list_y + i * l->row_h;
|
|
|
|
|
+ int ty = ry + (l->row_h - 16) / 2;
|
|
|
|
|
+ int tile = l->row_h - 4;
|
|
|
|
|
+
|
|
|
|
|
+ if (tile > SM_TILE)
|
|
|
|
|
+ tile = SM_TILE;
|
|
|
|
|
+ if (sm_hot == i)
|
|
|
|
|
+ usurf_fill(&screen, l->x + 4, ry + 1, l->w - 8,
|
|
|
|
|
+ (unsigned int)(l->row_h - 2), 0x365CA6u);
|
|
|
|
|
+ sm_tile(l->x + 10, ry + (l->row_h - tile) / 2, tile,
|
|
|
|
|
+ a->tile, a->letter);
|
|
|
|
|
+ usurf_text(&screen, l->x + 36, ty, a->label,
|
|
|
|
|
+ sm_hot == i ? COL_WHITE : 0xE8E8F6u,
|
|
|
|
|
+ l->x, l->y, l->w, l->h);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static void sm_draw(void)
|
|
|
|
|
+{
|
|
|
|
|
+ struct sm_layout l;
|
|
|
|
|
+ unsigned int ver_w;
|
|
|
|
|
+ int i, ty;
|
|
|
|
|
+
|
|
|
|
|
+ if (!sm_open)
|
|
|
|
|
+ return;
|
|
|
|
|
+ sm_layout_get(&l);
|
|
|
|
|
+ sm_frame(l.x, l.y, l.w, l.h);
|
|
|
|
|
+
|
|
|
|
|
+ ver_w = usurf_text_width(&screen, "v" OS_VERSION);
|
|
|
|
|
+ usurf_text(&screen, l.x + 12, l.y + 6, OS_NAME, COL_WHITE,
|
|
|
|
|
+ l.x, l.y, (unsigned int)l.w, (unsigned int)l.h);
|
|
|
|
|
+ usurf_text(&screen, l.x + l.w - 12 - (int)ver_w, l.y + 6,
|
|
|
|
|
+ "v" OS_VERSION, 0x9A9AAEu,
|
|
|
|
|
+ l.x, l.y, (unsigned int)l.w, (unsigned int)l.h);
|
|
|
|
|
+ usurf_text(&screen, l.x + 12, l.y + 25, "All apps", 0x9A9AAEu,
|
|
|
|
|
+ l.x, l.y, (unsigned int)l.w, (unsigned int)l.h);
|
|
|
|
|
+ usurf_fill(&screen, l.x + 8, l.list_y - 1, l.w - 16, 1, 0x3A3A55u);
|
|
|
|
|
+
|
|
|
|
|
+ for (i = 0; i < SM_NAPP; i++)
|
|
|
|
|
+ sm_draw_app(i, &l);
|
|
|
|
|
+
|
|
|
|
|
+ /* Power row and the separator above it. */
|
|
|
|
|
+ usurf_fill(&screen, l.x + 8, l.power_y - 4, l.w - 16, 1, 0x3A3A55u);
|
|
|
|
|
+ if (sm_power_hot == 1 || sm_power_open)
|
|
|
|
|
+ usurf_fill(&screen, l.x + 4, l.power_y + 1, l.w - 8,
|
|
|
|
|
+ (unsigned int)(l.row_h - 2), 0x365CA6u);
|
|
|
|
|
+ ty = l.power_y + (l.row_h - 16) / 2;
|
|
|
|
|
+ usurf_text(&screen, l.x + 12, ty, "Power",
|
|
|
|
|
+ sm_power_hot == 1 || sm_power_open ? COL_WHITE : 0xE8E8F6u,
|
|
|
|
|
+ l.x, l.y, (unsigned int)l.w, (unsigned int)l.h);
|
|
|
|
|
+ {
|
|
|
|
|
+ const char *arrow = sm_power_open ? "v" : ">";
|
|
|
|
|
+ int aw = (int)usurf_text_width(&screen, arrow);
|
|
|
|
|
+
|
|
|
|
|
+ usurf_text(&screen, l.x + l.w - 12 - aw, ty, arrow,
|
|
|
|
|
+ 0x9A9AAEu, l.x, l.y, (unsigned int)l.w,
|
|
|
|
|
+ (unsigned int)l.h);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (!sm_power_open)
|
|
|
|
|
+ return;
|
|
|
|
|
+ sm_frame(l.sub_x, l.sub_y, l.sub_w, l.sub_h);
|
|
|
|
|
+ for (i = 0; i < 2; i++) {
|
|
|
|
|
+ int sy = l.sub_y + 2 + i * l.row_h;
|
|
|
|
|
+ int sty = sy + (l.row_h - 16) / 2;
|
|
|
|
|
+
|
|
|
|
|
+ if (sm_power_hot == i + 2)
|
|
|
|
|
+ usurf_fill(&screen, l.sub_x + 3, sy + 1, l.sub_w - 6,
|
|
|
|
|
+ (unsigned int)(l.row_h - 2), 0x365CA6u);
|
|
|
|
|
+ usurf_text(&screen, l.sub_x + 12, sty,
|
|
|
|
|
+ i == 0 ? "Reboot" : "Power off",
|
|
|
|
|
+ i == 1 ? (sm_power_hot == 3 ? COL_WHITE : 0xFF9090u)
|
|
|
|
|
+ : (sm_power_hot == 2 ? COL_WHITE
|
|
|
|
|
+ : 0xE8E8F6u),
|
|
|
|
|
+ l.sub_x, l.sub_y, (unsigned int)l.sub_w,
|
|
|
|
|
+ (unsigned int)l.sub_h);
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static int sm_hit(unsigned int mx, unsigned int my)
|
|
|
|
|
+{
|
|
|
|
|
+ struct sm_layout l;
|
|
|
|
|
+ int x = (int)mx, y = (int)my;
|
|
|
|
|
+
|
|
|
|
|
+ if (bar_start_hit(mx, my))
|
|
|
|
|
+ return SM_HIT_START;
|
|
|
|
|
+ if (!sm_open)
|
|
|
|
|
+ return SM_HIT_NONE;
|
|
|
|
|
+ sm_layout_get(&l);
|
|
|
|
|
+ if (sm_power_open &&
|
|
|
|
|
+ x >= l.sub_x && x < l.sub_x + l.sub_w &&
|
|
|
|
|
+ y >= l.sub_y + 2 && y < l.sub_y + 2 + 2 * l.row_h)
|
|
|
|
|
+ return (y - (l.sub_y + 2)) / l.row_h == 0 ?
|
|
|
|
|
+ SM_HIT_REBOOT : SM_HIT_POWEROFF;
|
|
|
|
|
+ if (x < l.x || x >= l.x + l.w)
|
|
|
|
|
+ return SM_HIT_NONE;
|
|
|
|
|
+ if (y >= l.list_y && y < l.list_y + SM_NAPP * l.row_h)
|
|
|
|
|
+ return (y - l.list_y) / l.row_h;
|
|
|
|
|
+ if (y >= l.power_y && y < l.power_y + l.row_h)
|
|
|
|
|
+ return SM_HIT_POWER;
|
|
|
|
|
+ return SM_HIT_NONE;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static int sm_update_hover(unsigned int mx, unsigned int my)
|
|
|
|
|
+{
|
|
|
|
|
+ int hot = -1, pwr = 0, hit;
|
|
|
|
|
+
|
|
|
|
|
+ if (sm_open) {
|
|
|
|
|
+ hit = sm_hit(mx, my);
|
|
|
|
|
+ if (hit >= 0)
|
|
|
|
|
+ hot = hit;
|
|
|
|
|
+ else if (hit == SM_HIT_POWER)
|
|
|
|
|
+ pwr = 1;
|
|
|
|
|
+ else if (hit == SM_HIT_REBOOT)
|
|
|
|
|
+ pwr = 2;
|
|
|
|
|
+ else if (hit == SM_HIT_POWEROFF)
|
|
|
|
|
+ pwr = 3;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (hot == sm_hot && pwr == sm_power_hot)
|
|
|
|
|
+ return 0;
|
|
|
|
|
+ sm_hot = hot;
|
|
|
|
|
+ sm_power_hot = pwr;
|
|
|
|
|
+ return 1;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static void sm_add_present(struct wm_present_info *p)
|
|
|
|
|
+{
|
|
|
|
|
+ struct sm_layout l;
|
|
|
|
|
+
|
|
|
|
|
+ if (!sm_open)
|
|
|
|
|
+ return;
|
|
|
|
|
+ sm_layout_get(&l);
|
|
|
|
|
+ add_rect(p, l.x, l.y, (unsigned int)l.w, (unsigned int)l.h);
|
|
|
|
|
+ if (sm_power_open)
|
|
|
|
|
+ add_rect(p, l.sub_x, l.sub_y, (unsigned int)l.sub_w,
|
|
|
|
|
+ (unsigned int)l.sub_h);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static void sm_close(void)
|
|
|
|
|
+{
|
|
|
|
|
+ if (!sm_open && !sm_power_open)
|
|
|
|
|
+ return;
|
|
|
|
|
+ sm_open = 0;
|
|
|
|
|
+ sm_power_open = 0;
|
|
|
|
|
+ sm_hot = -1;
|
|
|
|
|
+ sm_power_hot = 0;
|
|
|
|
|
+ full_redraw = 1;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
static void do_update(struct wm_status *st)
|
|
static void do_update(struct wm_status *st)
|
|
@@ -1377,6 +1677,7 @@ static void do_update(struct wm_status *st)
|
|
|
(st->kexec_busy && st->kexec_progress != bar_kexec_progress);
|
|
(st->kexec_busy && st->kexec_progress != bar_kexec_progress);
|
|
|
unsigned int msg_now = u_ticks_ms();
|
|
unsigned int msg_now = u_ticks_ms();
|
|
|
int osd_hide = 0, osd_repaint = 0;
|
|
int osd_hide = 0, osd_repaint = 0;
|
|
|
|
|
+ int sm_dirty;
|
|
|
|
|
|
|
|
/* The kernel bumps backlight_seq on every brightness key/command.
|
|
/* The kernel bumps backlight_seq on every brightness key/command.
|
|
|
* Pop the OSD on a change and keep it up for OSD_MS after the last
|
|
* Pop the OSD on a change and keep it up for OSD_MS after the last
|
|
@@ -1403,6 +1704,8 @@ static void do_update(struct wm_status *st)
|
|
|
if (osd_hide && osd_visible)
|
|
if (osd_hide && osd_visible)
|
|
|
osd_repaint = 1;
|
|
osd_repaint = 1;
|
|
|
|
|
|
|
|
|
|
+ sm_dirty = sm_update_hover(st->mouse.x, st->mouse.y);
|
|
|
|
|
+
|
|
|
/* The boot-scan window is created before the terminal so the terminal
|
|
/* The boot-scan window is created before the terminal so the terminal
|
|
|
* stays the newest (last) window and keeps the keyboard focus. Wait
|
|
* stays the newest (last) window and keeps the keyboard focus. Wait
|
|
|
* for the scan window to exist before starting the terminal; a failed
|
|
* for the scan window to exist before starting the terminal; a failed
|
|
@@ -1466,6 +1769,14 @@ static void do_update(struct wm_status *st)
|
|
|
if (kexec_changed)
|
|
if (kexec_changed)
|
|
|
bar_dirty = 1;
|
|
bar_dirty = 1;
|
|
|
|
|
|
|
|
|
|
+ {
|
|
|
|
|
+ int hot = bar_start_hit(st->mouse.x, st->mouse.y);
|
|
|
|
|
+
|
|
|
|
|
+ if (hot != sm_start_hot) {
|
|
|
|
|
+ sm_start_hot = hot;
|
|
|
|
|
+ bar_dirty = 1;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
{
|
|
{
|
|
|
int hot = bar_clock_hit(st->mouse.x, st->mouse.y);
|
|
int hot = bar_clock_hit(st->mouse.x, st->mouse.y);
|
|
|
|
|
|
|
@@ -1636,6 +1947,7 @@ static void do_update(struct wm_status *st)
|
|
|
if (osd_show)
|
|
if (osd_show)
|
|
|
osd_draw();
|
|
osd_draw();
|
|
|
osd_visible = osd_show;
|
|
osd_visible = osd_show;
|
|
|
|
|
+ sm_draw();
|
|
|
present.count = 0;
|
|
present.count = 0;
|
|
|
add_rect(&present, 0, 0, fbw, fbh);
|
|
add_rect(&present, 0, 0, fbw, fbh);
|
|
|
present.immediate = 0;
|
|
present.immediate = 0;
|
|
@@ -1691,12 +2003,16 @@ static void do_update(struct wm_status *st)
|
|
|
add_rect(&present, bar_pwr_tip_on_x, bar_pwr_tip_on_y,
|
|
add_rect(&present, bar_pwr_tip_on_x, bar_pwr_tip_on_y,
|
|
|
bar_pwr_tip_on_w, bar_pwr_tip_on_h);
|
|
bar_pwr_tip_on_w, bar_pwr_tip_on_h);
|
|
|
}
|
|
}
|
|
|
|
|
+ if (sm_dirty && sm_open)
|
|
|
|
|
+ need = 1;
|
|
|
|
|
|
|
|
if (!need) {
|
|
if (!need) {
|
|
|
/* Drag movement is handled below; a stationary mouse can be
|
|
/* Drag movement is handled below; a stationary mouse can be
|
|
|
* left to the kernel's cursor overlay. */
|
|
* left to the kernel's cursor overlay. */
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
+ if (sm_open)
|
|
|
|
|
+ sm_add_present(&present);
|
|
|
if (u_wm_begin() != 0)
|
|
if (u_wm_begin() != 0)
|
|
|
return;
|
|
return;
|
|
|
|
|
|
|
@@ -1717,6 +2033,7 @@ static void do_update(struct wm_status *st)
|
|
|
add_rect(&present, osd_x, osd_y, osd_w, osd_h);
|
|
add_rect(&present, osd_x, osd_y, osd_w, osd_h);
|
|
|
}
|
|
}
|
|
|
osd_visible = osd_show;
|
|
osd_visible = osd_show;
|
|
|
|
|
+ sm_draw();
|
|
|
|
|
|
|
|
for (i = 0; i < WM_MAX_WINDOWS; i++) {
|
|
for (i = 0; i < WM_MAX_WINDOWS; i++) {
|
|
|
struct uwin *u = &wins[i];
|
|
struct uwin *u = &wins[i];
|
|
@@ -1730,25 +2047,18 @@ static void do_update(struct wm_status *st)
|
|
|
u_wm_present(&present);
|
|
u_wm_present(&present);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-static int spawn_app(const char *path)
|
|
|
|
|
-{
|
|
|
|
|
- int pid = u_spawn(path, "", 0, "/");
|
|
|
|
|
-
|
|
|
|
|
- if (pid > 0)
|
|
|
|
|
- full_redraw = 1;
|
|
|
|
|
- return pid;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-static void spawn_app_checked(const char *path)
|
|
|
|
|
|
|
+static void spawn_app_arg_checked(const char *path, const char *arg)
|
|
|
{
|
|
{
|
|
|
if (!free_window_slot()) {
|
|
if (!free_window_slot()) {
|
|
|
bar_notice("window limit");
|
|
bar_notice("window limit");
|
|
|
full_redraw = 1;
|
|
full_redraw = 1;
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- if (spawn_app(path) < 0) {
|
|
|
|
|
|
|
+ if (u_spawn(path, arg, 0, "/") < 0) {
|
|
|
bar_notice("spawn failed");
|
|
bar_notice("spawn failed");
|
|
|
full_redraw = 1;
|
|
full_redraw = 1;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ full_redraw = 1;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1788,6 +2098,35 @@ static void open_control_panel(void)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+/* Launch one start-menu entry. The terminal and the control panel are WM
|
|
|
|
|
+ * actions; every other entry spawns its ELF from the pack. */
|
|
|
|
|
+static void sm_launch(int idx)
|
|
|
|
|
+{
|
|
|
|
|
+ const struct sm_app *a;
|
|
|
|
|
+
|
|
|
|
|
+ if (idx < 0 || idx >= SM_NAPP) {
|
|
|
|
|
+ sm_close();
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ a = &sm_apps[idx];
|
|
|
|
|
+ sm_close();
|
|
|
|
|
+ if (a->action == SM_ACT_TERM) {
|
|
|
|
|
+ if (!free_window_slot()) {
|
|
|
|
|
+ bar_notice("window limit");
|
|
|
|
|
+ full_redraw = 1;
|
|
|
|
|
+ } else if (u_wm_create_term() < 0) {
|
|
|
|
|
+ bar_notice("cannot start term");
|
|
|
|
|
+ full_redraw = 1;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ full_redraw = 1;
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if (a->action == SM_ACT_SETTINGS) {
|
|
|
|
|
+ open_control_panel();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ spawn_app_arg_checked(a->path, a->arg);
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
/* Index of a popover containing the point, or -1. */
|
|
/* Index of a popover containing the point, or -1. */
|
|
|
static int popover_under(unsigned int mx, unsigned int my)
|
|
static int popover_under(unsigned int mx, unsigned int my)
|
|
|
{
|
|
{
|
|
@@ -1827,30 +2166,6 @@ static void dismiss_popover_outside(unsigned int mx, unsigned int my)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-/* Top-bar launcher under (mx, my)? Same rectangles as the click chain in
|
|
|
|
|
- * handle_mouse(); every launcher shares WM_BTN_Y/WM_BTN_H. */
|
|
|
|
|
-static int bar_launcher_hit(unsigned int mx, unsigned int my)
|
|
|
|
|
-{
|
|
|
|
|
- static const int x0[] = {
|
|
|
|
|
- WM_BTN_X, WM_BTN_CLOCK_X, WM_BTN_COLORS_X, WM_BTN_FILES_X,
|
|
|
|
|
- WM_BTN_MINES_X, WM_BTN_WEB_X, WM_BTN_CARDS_X, WM_BTN_GALLERY_X,
|
|
|
|
|
- WM_BTN_CHAT_X, WM_BTN_DISKS_X, WM_BTN_PROCESS_X
|
|
|
|
|
- };
|
|
|
|
|
- static const int w[] = {
|
|
|
|
|
- WM_BTN_W, WM_BTN_CLOCK_W, WM_BTN_COLORS_W, WM_BTN_FILES_W,
|
|
|
|
|
- WM_BTN_MINES_W, WM_BTN_WEB_W, WM_BTN_CARDS_W, WM_BTN_GALLERY_W,
|
|
|
|
|
- WM_BTN_CHAT_W, WM_BTN_DISKS_W, WM_BTN_PROCESS_W
|
|
|
|
|
- };
|
|
|
|
|
- unsigned int i;
|
|
|
|
|
-
|
|
|
|
|
- if ((int)my < WM_BTN_Y || (int)my >= WM_BTN_Y + WM_BTN_H)
|
|
|
|
|
- return 0;
|
|
|
|
|
- for (i = 0; i < sizeof(x0) / sizeof(x0[0]); i++)
|
|
|
|
|
- if ((int)mx >= x0[i] && (int)mx < x0[i] + w[i])
|
|
|
|
|
- return 1;
|
|
|
|
|
- return 0;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
/* Apply one edge-drag step. The grabbed edges follow the pointer while the
|
|
/* Apply one edge-drag step. The grabbed edges follow the pointer while the
|
|
|
* opposite edges stay put; the work area clamps the active edges. */
|
|
* opposite edges stay put; the work area clamps the active edges. */
|
|
|
static void resize_window_drag(struct uwin *u, unsigned int idx,
|
|
static void resize_window_drag(struct uwin *u, unsigned int idx,
|
|
@@ -1935,9 +2250,9 @@ static void begin_resize(unsigned int idx, int edges, unsigned int mx,
|
|
|
|
|
|
|
|
/* The WM's cursor override (SYS_WM_SET_CURSOR): resize arrows on the
|
|
/* The WM's cursor override (SYS_WM_SET_CURSOR): resize arrows on the
|
|
|
* invisible resize border and while resizing, the move cross while a
|
|
* invisible resize border and while resizing, the move cross while a
|
|
|
- * title-bar drag is under way, a hand over the launchers and the status
|
|
|
|
|
- * area. Everywhere else the kernel picks the window's own content cursor
|
|
|
|
|
- * (or the arrow). */
|
|
|
|
|
|
|
+ * title-bar drag is under way, a hand over the start button, the open start
|
|
|
|
|
+ * menu and the status area. Everywhere else the kernel picks the window's
|
|
|
|
|
+ * own content cursor (or the arrow). */
|
|
|
static void update_cursor(unsigned int mx, unsigned int my)
|
|
static void update_cursor(unsigned int mx, unsigned int my)
|
|
|
{
|
|
{
|
|
|
static int current = CURSOR_NO_OVERRIDE;
|
|
static int current = CURSOR_NO_OVERRIDE;
|
|
@@ -1948,8 +2263,13 @@ static void update_cursor(unsigned int mx, unsigned int my)
|
|
|
} else if (drag_id >= 0) {
|
|
} else if (drag_id >= 0) {
|
|
|
if (drag_moved)
|
|
if (drag_moved)
|
|
|
want = CURSOR_MOVE;
|
|
want = CURSOR_MOVE;
|
|
|
|
|
+ } else if (sm_open) {
|
|
|
|
|
+ /* The menu is modal: a hand over its items, the arrow
|
|
|
|
|
+ * elsewhere, never a window's content cursor underneath. */
|
|
|
|
|
+ want = sm_hit(mx, my) == SM_HIT_NONE ?
|
|
|
|
|
+ CURSOR_DEFAULT : CURSOR_POINTER;
|
|
|
} else if (my < WM_BAR_H) {
|
|
} else if (my < WM_BAR_H) {
|
|
|
- if (bar_launcher_hit(mx, my) || bar_status_hit(mx, my))
|
|
|
|
|
|
|
+ if (bar_start_hit(mx, my) || bar_status_hit(mx, my))
|
|
|
want = CURSOR_POINTER;
|
|
want = CURSOR_POINTER;
|
|
|
} else {
|
|
} else {
|
|
|
int edges = 0;
|
|
int edges = 0;
|
|
@@ -1973,63 +2293,51 @@ static void handle_mouse(struct wm_status *st)
|
|
|
if (down && !was) {
|
|
if (down && !was) {
|
|
|
int prev_title_id = last_title_id;
|
|
int prev_title_id = last_title_id;
|
|
|
unsigned int now = u_ticks_ms();
|
|
unsigned int now = u_ticks_ms();
|
|
|
-
|
|
|
|
|
|
|
+ int hit;
|
|
|
|
|
+
|
|
|
|
|
+ /* The start menu is modal: a press on an entry launches it,
|
|
|
|
|
+ * a press on Power opens its submenu, and any other press
|
|
|
|
|
+ * dismisses the menu without reaching the window below. */
|
|
|
|
|
+ if (sm_open) {
|
|
|
|
|
+ hit = sm_hit(mx, my);
|
|
|
|
|
+ last_title_id = -1;
|
|
|
|
|
+ if (hit == SM_HIT_START) {
|
|
|
|
|
+ sm_close();
|
|
|
|
|
+ } else if (hit == SM_HIT_POWER) {
|
|
|
|
|
+ sm_power_open = !sm_power_open;
|
|
|
|
|
+ full_redraw = 1;
|
|
|
|
|
+ } else if (hit == SM_HIT_REBOOT) {
|
|
|
|
|
+ sm_close();
|
|
|
|
|
+ if (u_spawn_kcmd("reboot", "", 0) < 0)
|
|
|
|
|
+ bar_notice("reboot failed");
|
|
|
|
|
+ } else if (hit == SM_HIT_POWEROFF) {
|
|
|
|
|
+ sm_close();
|
|
|
|
|
+ if (u_spawn_kcmd("poweroff", "", 0) < 0)
|
|
|
|
|
+ bar_notice("poweroff failed");
|
|
|
|
|
+ } else if (hit >= 0) {
|
|
|
|
|
+ sm_launch(hit);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ sm_close();
|
|
|
|
|
+ }
|
|
|
|
|
+ goto mouse_done;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (bar_start_hit(mx, my)) {
|
|
|
|
|
+ /* Opening the menu also closes an open control
|
|
|
|
|
+ * panel, so only one floating panel is visible. */
|
|
|
|
|
+ dismiss_popover_outside(mx, my);
|
|
|
|
|
+ last_title_id = -1;
|
|
|
|
|
+ sm_open = 1;
|
|
|
|
|
+ sm_power_open = 0;
|
|
|
|
|
+ sm_hot = -1;
|
|
|
|
|
+ sm_power_hot = 0;
|
|
|
|
|
+ full_redraw = 1;
|
|
|
|
|
+ goto mouse_done;
|
|
|
|
|
+ }
|
|
|
if (!bar_status_hit(mx, my))
|
|
if (!bar_status_hit(mx, my))
|
|
|
dismiss_popover_outside(mx, my);
|
|
dismiss_popover_outside(mx, my);
|
|
|
last_title_id = -1;
|
|
last_title_id = -1;
|
|
|
if (bar_status_hit(mx, my)) {
|
|
if (bar_status_hit(mx, my)) {
|
|
|
open_control_panel();
|
|
open_control_panel();
|
|
|
- } else if (mx >= WM_BTN_X && my >= WM_BTN_Y &&
|
|
|
|
|
- mx < WM_BTN_X + WM_BTN_W && my < WM_BTN_Y + WM_BTN_H) {
|
|
|
|
|
- if (!free_window_slot()) {
|
|
|
|
|
- bar_notice("window limit");
|
|
|
|
|
- full_redraw = 1;
|
|
|
|
|
- } else if (u_wm_create_term() < 0) {
|
|
|
|
|
- bar_notice("cannot start term");
|
|
|
|
|
- full_redraw = 1;
|
|
|
|
|
- } else {
|
|
|
|
|
- full_redraw = 1;
|
|
|
|
|
- }
|
|
|
|
|
- } else if (mx >= WM_BTN_CLOCK_X && my >= WM_BTN_CLOCK_Y &&
|
|
|
|
|
- mx < WM_BTN_CLOCK_X + WM_BTN_CLOCK_W &&
|
|
|
|
|
- my < WM_BTN_CLOCK_Y + WM_BTN_CLOCK_H) {
|
|
|
|
|
- spawn_app_checked("/ramfs/bin/clock");
|
|
|
|
|
- } else if (mx >= WM_BTN_COLORS_X && my >= WM_BTN_COLORS_Y &&
|
|
|
|
|
- mx < WM_BTN_COLORS_X + WM_BTN_COLORS_W &&
|
|
|
|
|
- my < WM_BTN_COLORS_Y + WM_BTN_COLORS_H) {
|
|
|
|
|
- spawn_app_checked("/ramfs/bin/colors");
|
|
|
|
|
- } else if (mx >= WM_BTN_FILES_X && my >= WM_BTN_FILES_Y &&
|
|
|
|
|
- mx < WM_BTN_FILES_X + WM_BTN_FILES_W &&
|
|
|
|
|
- my < WM_BTN_FILES_Y + WM_BTN_FILES_H) {
|
|
|
|
|
- spawn_app_checked("/ramfs/bin/files");
|
|
|
|
|
- } else if (mx >= WM_BTN_MINES_X && my >= WM_BTN_MINES_Y &&
|
|
|
|
|
- mx < WM_BTN_MINES_X + WM_BTN_MINES_W &&
|
|
|
|
|
- my < WM_BTN_MINES_Y + WM_BTN_MINES_H) {
|
|
|
|
|
- spawn_app_checked("/ramfs/bin/mines");
|
|
|
|
|
- } else if (mx >= WM_BTN_WEB_X && my >= WM_BTN_WEB_Y &&
|
|
|
|
|
- mx < WM_BTN_WEB_X + WM_BTN_WEB_W &&
|
|
|
|
|
- my < WM_BTN_WEB_Y + WM_BTN_WEB_H) {
|
|
|
|
|
- spawn_app_checked("/ramfs/bin/browser");
|
|
|
|
|
- } else if (mx >= WM_BTN_CARDS_X && my >= WM_BTN_CARDS_Y &&
|
|
|
|
|
- mx < WM_BTN_CARDS_X + WM_BTN_CARDS_W &&
|
|
|
|
|
- my < WM_BTN_CARDS_Y + WM_BTN_CARDS_H) {
|
|
|
|
|
- spawn_app_checked("/ramfs/bin/solitaire");
|
|
|
|
|
- } else if (mx >= WM_BTN_GALLERY_X && my >= WM_BTN_GALLERY_Y &&
|
|
|
|
|
- mx < WM_BTN_GALLERY_X + WM_BTN_GALLERY_W &&
|
|
|
|
|
- my < WM_BTN_GALLERY_Y + WM_BTN_GALLERY_H) {
|
|
|
|
|
- spawn_app_checked("/ramfs/bin/gallery");
|
|
|
|
|
- } else if (mx >= WM_BTN_CHAT_X && my >= WM_BTN_CHAT_Y &&
|
|
|
|
|
- mx < WM_BTN_CHAT_X + WM_BTN_CHAT_W &&
|
|
|
|
|
- my < WM_BTN_CHAT_Y + WM_BTN_CHAT_H) {
|
|
|
|
|
- spawn_app_checked("/ramfs/bin/chat");
|
|
|
|
|
- } else if (mx >= WM_BTN_DISKS_X && my >= WM_BTN_DISKS_Y &&
|
|
|
|
|
- mx < WM_BTN_DISKS_X + WM_BTN_DISKS_W &&
|
|
|
|
|
- my < WM_BTN_DISKS_Y + WM_BTN_DISKS_H) {
|
|
|
|
|
- spawn_app_checked("/ramfs/bin/disks");
|
|
|
|
|
- } else if (mx >= WM_BTN_PROCESS_X && my >= WM_BTN_PROCESS_Y &&
|
|
|
|
|
- mx < WM_BTN_PROCESS_X + WM_BTN_PROCESS_W &&
|
|
|
|
|
- my < WM_BTN_PROCESS_Y + WM_BTN_PROCESS_H) {
|
|
|
|
|
- spawn_app_checked("/ramfs/bin/process");
|
|
|
|
|
} else {
|
|
} else {
|
|
|
int edges = 0;
|
|
int edges = 0;
|
|
|
int idx = resize_hit((int)mx, (int)my, &edges);
|
|
int idx = resize_hit((int)mx, (int)my, &edges);
|
|
@@ -2177,6 +2485,7 @@ static void handle_mouse(struct wm_status *st)
|
|
|
resize_id = -1;
|
|
resize_id = -1;
|
|
|
u_wm_mouse_capture(0);
|
|
u_wm_mouse_capture(0);
|
|
|
}
|
|
}
|
|
|
|
|
+mouse_done:
|
|
|
prev_buttons = buttons;
|
|
prev_buttons = buttons;
|
|
|
update_cursor(mx, my);
|
|
update_cursor(mx, my);
|
|
|
}
|
|
}
|