Skip to content

Commit

Permalink
[GUI] Taskbar vertical centering
Browse files Browse the repository at this point in the history
  • Loading branch information
PeyTy committed Dec 22, 2023
1 parent 1f7c74d commit 91be0b3
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions kernel/gui/compositor.hexa
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ fun composite(startupMilliseconds UInt64) {
// TODO create Theme class with static fields
// TODO ^ move other elements to the right
// TODO finally unify, use Int16 ot UInt16 everywhere lol!
drawBitmap32WithAlpha(leaves, leavesPad + 2i16, taskbarY + 2i16)
drawBitmap32WithAlpha(leaves, leavesPad + 2i16, taskbarY + (Theme.hugeTaskbar? 7i16 : 2i16))
// TODO ^ white leaves or dynamically recolored depending on wallpaper or something
// ^ change color on hover

Expand Down Expand Up @@ -856,14 +856,15 @@ fun composite(startupMilliseconds UInt64) {
}

let trayTimeStartX = trayButtonX + 20
let trayTimeY = taskbarY + (Theme.hugeTaskbar? 15i16 : 10i16)
var trayTimeX = trayTimeStartX + 4
trayTimeX += drawIntegerText(uptimeHours, trayTimeX, taskbarY + 10i16, color.ref)
trayTimeX += drawAsciiText(":", trayTimeX, taskbarY + 10i16, color.ref)
trayTimeX += drawIntegerText(uptimeHours, trayTimeX, trayTimeY, color.ref)
trayTimeX += drawAsciiText(":", trayTimeX, trayTimeY, color.ref)
if uptimeMinutes < 10 {
trayTimeX += drawAsciiText("0", trayTimeX, taskbarY + 10i16, color.ref)
trayTimeX += drawAsciiText("0", trayTimeX, trayTimeY, color.ref)
}
trayTimeX += drawIntegerText(uptimeMinutes, trayTimeX, taskbarY + 10i16, color.ref)
trayTimeX += drawAsciiText(pm ? " PM" : " AM", trayTimeX, taskbarY + 10i16, color.ref)
trayTimeX += drawIntegerText(uptimeMinutes, trayTimeX, trayTimeY, color.ref)
trayTimeX += drawAsciiText(pm ? " PM" : " AM", trayTimeX, trayTimeY, color.ref)

// Input language
if let rectangle = defaultSession.taskbarInput, rectangle.mouseOver {
Expand All @@ -878,7 +879,7 @@ fun composite(startupMilliseconds UInt64) {
let languageId = 'ENG'
let languagePad = 8
var trayLanguageX = trayTimeStartX - getTextAdvance(languageId) - languagePad * 2
drawAsciiText(languageId, trayLanguageX, taskbarY + 10i16, color.ref)
drawAsciiText(languageId, trayLanguageX, trayTimeY, color.ref)

// Tray ^ button
// TODO Hexa: try `if let item = defaultSession.taskbarTrayOpener, item.mouseOver { item.xxx }` pattern
Expand All @@ -894,8 +895,8 @@ fun composite(startupMilliseconds UInt64) {

trayButtonX = trayLanguageX - languagePad - 16i16

line45smooth(color, trayButtonX, taskbarY + 10 + 2i16, 6i16, 1i16)
line45smooth(color, trayButtonX + 1i16, taskbarY + 10 + 2i16, 6i16, -1i16)
line45smooth(color, trayButtonX, trayTimeY + 2i16, 6i16, 1i16)
line45smooth(color, trayButtonX + 1i16, trayTimeY + 2i16, 6i16, -1i16)

// Search
if defaultSession.taskbarSearch.mouseOver {
Expand All @@ -912,7 +913,7 @@ fun composite(startupMilliseconds UInt64) {
traySearchIcon,
// TODO probably compute global positions for all once in the begin of composition?
defaultSession.taskbarSearch.relativeX + 5i16,
taskbarY + 4i16
taskbarY + (Theme.hugeTaskbar? 9i16 : 4i16)
)

// Tray popup
Expand Down

0 comments on commit 91be0b3

Please sign in to comment.