diff options
author | nacitar sevaht <nacitar@ubercpp.com> | 2011-05-16 17:21:47 (GMT) |
---|---|---|
committer | Mathias Gumz <akira at fluxbox dot org> | 2011-05-16 18:03:02 (GMT) |
commit | fd6fbb80e7a6c1d62d696a4f598edc1101b13194 (patch) | |
tree | 2407369a89a05c270916bef2172dc0337ada10f7 | |
parent | 16c90dc19fcd68fccbcfb277b3839e7f41fe9dd3 (diff) | |
download | fluxbox_paul-fd6fbb80e7a6c1d62d696a4f598edc1101b13194.zip fluxbox_paul-fd6fbb80e7a6c1d62d696a4f598edc1101b13194.tar.bz2 |
TextDialog and ToolTipWindow style rendering bugs fixed
TextDialog windows (such as 'set title', or 'edit clock format') now
properly render their titlebar to match the current style. Previously,
the titlebar font settings were controlled by window.font.*, and this
became apparent because window.font.effect needed to be set to put
'halo' on the titlebar of these TextDialogs. However,
window.font.effect controls the effect on the text within the editbox on
these as well, having these set in the same location is far from
desirable. Specifically because the TextDialog essentially emulates the
titlebar of other windows. So, after this change, window.font.effect
still controls the text in the editbox, but the titlebar area is themed
as the titlebars of other windows.
Text justification of titlebar and border width, is now respected in
TextDialog. Also, previously the edit box was sized in an odd way; one
which left part of the window actually undrawn (so you'd get artifacts
from whatever happened to be on the screen in that position when it
opened); this has been addressed.
TextDialogs, rather than going to the center of the entire desktop, now
center on the _current head_, which prevents the awful positioning where
half of the window is on one screen and half is on another.
Lastly, when hovering your mouse over the iconbar button for a window
with a title that's too wide to fit on the button, a tooltip is
displayed. This tooltip themes itself to match the button, however it
wasn't using the theme properly (similarly to how TextDialog was)... and
as such, also wasn't using the proper font effects. This has been
addressed just as it was for the TextDialog.
-rw-r--r-- | src/TextDialog.cc | 19 | ||||
-rw-r--r-- | src/TooltipWindow.cc | 9 |
2 files changed, 17 insertions, 11 deletions
diff --git a/src/TextDialog.cc b/src/TextDialog.cc index 5e9ce82..dc35dbe 100644 --- a/src/TextDialog.cc +++ b/src/TextDialog.cc | |||
@@ -44,7 +44,7 @@ TextDialog::TextDialog(BScreen &screen, | |||
44 | const string &title) : | 44 | const string &title) : |
45 | FbTk::FbWindow(screen.rootWindow().screenNumber(), 0, 0, 200, 1, ExposureMask), | 45 | FbTk::FbWindow(screen.rootWindow().screenNumber(), 0, 0, 200, 1, ExposureMask), |
46 | m_textbox(*this, screen.focusedWinFrameTheme()->font(), ""), | 46 | m_textbox(*this, screen.focusedWinFrameTheme()->font(), ""), |
47 | m_label(*this, screen.focusedWinFrameTheme()->font(), title), | 47 | m_label(*this, screen.focusedWinFrameTheme()->iconbarTheme().text().font(), title), |
48 | m_gc(m_textbox), | 48 | m_gc(m_textbox), |
49 | m_screen(screen), | 49 | m_screen(screen), |
50 | m_move_x(0), | 50 | m_move_x(0), |
@@ -156,6 +156,7 @@ void TextDialog::init() { | |||
156 | // we listen to motion notify too | 156 | // we listen to motion notify too |
157 | m_label.setEventMask(m_label.eventMask() | ButtonPressMask | ButtonMotionMask); | 157 | m_label.setEventMask(m_label.eventMask() | ButtonPressMask | ButtonMotionMask); |
158 | m_label.setGC(m_screen.focusedWinFrameTheme()->iconbarTheme().text().textGC()); | 158 | m_label.setGC(m_screen.focusedWinFrameTheme()->iconbarTheme().text().textGC()); |
159 | m_label.setJustify(m_screen.focusedWinFrameTheme()->iconbarTheme().text().justify()); | ||
159 | m_label.show(); | 160 | m_label.show(); |
160 | 161 | ||
161 | // setup text box | 162 | // setup text box |
@@ -167,10 +168,14 @@ void TextDialog::init() { | |||
167 | m_textbox.show(); | 168 | m_textbox.show(); |
168 | 169 | ||
169 | // setup this window | 170 | // setup this window |
170 | setBorderWidth(1); | 171 | setBorderWidth(m_screen.focusedWinFrameTheme()->border().width()); |
171 | setBackgroundColor(white); | 172 | setBorderColor(m_screen.focusedWinFrameTheme()->border().color()); |
172 | // move to center of the screen | 173 | |
173 | move((m_screen.width() - width())/2, (m_screen.height() - height())/2); | 174 | // move to center of the current head |
175 | unsigned int head = m_screen.getCurrHead(); | ||
176 | move(m_screen.getHeadX(head) + (m_screen.getHeadWidth(head) - width()) / 2, | ||
177 | m_screen.getHeadY(head) + (m_screen.getHeadHeight(head) - height()) / 2); | ||
178 | |||
174 | 179 | ||
175 | updateSizes(); | 180 | updateSizes(); |
176 | resize(width(), m_textbox.height() + m_label.height()); | 181 | resize(width(), m_textbox.height() + m_label.height()); |
@@ -185,6 +190,6 @@ void TextDialog::updateSizes() { | |||
185 | m_label.moveResize(0, 0, | 190 | m_label.moveResize(0, 0, |
186 | width(), m_textbox.font().height() + 2); | 191 | width(), m_textbox.font().height() + 2); |
187 | 192 | ||
188 | m_textbox.moveResize(2, m_label.height(), | 193 | m_textbox.moveResize(0, m_label.height(), |
189 | width() - 4, m_textbox.font().height() + 2); | 194 | width(), m_textbox.font().height() + 2); |
190 | } | 195 | } |
diff --git a/src/TooltipWindow.cc b/src/TooltipWindow.cc index 79d4163..0fb7273 100644 --- a/src/TooltipWindow.cc +++ b/src/TooltipWindow.cc | |||
@@ -55,8 +55,8 @@ void TooltipWindow::raiseTooltip() { | |||
55 | 55 | ||
56 | resize(m_lastText); | 56 | resize(m_lastText); |
57 | reconfigTheme(); | 57 | reconfigTheme(); |
58 | int h = theme()->font().height() + theme()->bevelWidth() * 2; | 58 | int h = theme()->iconbarTheme().text().font().height() + theme()->bevelWidth() * 2; |
59 | int w = theme()->font().textWidth(m_lastText) + theme()->bevelWidth() * 2; | 59 | int w = theme()->iconbarTheme().text().font().textWidth(m_lastText) + theme()->bevelWidth() * 2; |
60 | 60 | ||
61 | Window root_ret; // not used | 61 | Window root_ret; // not used |
62 | Window window_ret; // not used | 62 | Window window_ret; // not used |
@@ -90,11 +90,12 @@ void TooltipWindow::raiseTooltip() { | |||
90 | 90 | ||
91 | show(); | 91 | show(); |
92 | clear(); | 92 | clear(); |
93 | theme()->font().drawText(*this, screen().screenNumber(), | 93 | // TODO: make this use a TextButton like TextDialog does |
94 | theme()->iconbarTheme().text().font().drawText(*this, screen().screenNumber(), | ||
94 | theme()->iconbarTheme().text().textGC(), | 95 | theme()->iconbarTheme().text().textGC(), |
95 | m_lastText, | 96 | m_lastText, |
96 | theme()->bevelWidth(), | 97 | theme()->bevelWidth(), |
97 | theme()->bevelWidth() + theme()->font().ascent()); | 98 | theme()->bevelWidth() + theme()->iconbarTheme().text().font().ascent()); |
98 | } | 99 | } |
99 | 100 | ||
100 | void TooltipWindow::updateText(const FbTk::BiDiString& text) { | 101 | void TooltipWindow::updateText(const FbTk::BiDiString& text) { |