mirror of
https://github.com/fltk/fltk.git
synced 2026-06-02 15:46:52 +08:00
Solves Fl_Tree focus box artifacts on linux - fixes issue #299.
Nabbed the current code from Fl_Widget::draw_focus() which solves.
This commit is contained in:
+5
-24
@@ -796,6 +796,7 @@ Fl_Tree_Item *Fl_Tree_Item::find_clicked(const Fl_Tree_Prefs &prefs, int yonly)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void draw_item_focus(Fl_Boxtype B, Fl_Color fg, Fl_Color bg, int X, int Y, int W, int H) {
|
static void draw_item_focus(Fl_Boxtype B, Fl_Color fg, Fl_Color bg, int X, int Y, int W, int H) {
|
||||||
|
// Pasted from Fl_Widget::draw_focus(); we don't have access to this method
|
||||||
if (!Fl::visible_focus()) return;
|
if (!Fl::visible_focus()) return;
|
||||||
switch (B) {
|
switch (B) {
|
||||||
case FL_DOWN_BOX:
|
case FL_DOWN_BOX:
|
||||||
@@ -807,32 +808,12 @@ static void draw_item_focus(Fl_Boxtype B, Fl_Color fg, Fl_Color bg, int X, int Y
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
fl_color(fl_contrast(fg, bg));
|
|
||||||
|
|
||||||
//#if defined(USE_X11) || defined(__APPLE_QUARTZ__)
|
|
||||||
fl_line_style(FL_DOT);
|
|
||||||
fl_rect(X + Fl::box_dx(B), Y + Fl::box_dy(B),
|
|
||||||
W - Fl::box_dw(B) - 1, H - Fl::box_dh(B) - 1);
|
|
||||||
fl_line_style(FL_SOLID);
|
|
||||||
/*#else
|
|
||||||
// Some platforms don't implement dotted line style, so draw
|
|
||||||
// every other pixel around the focus area...
|
|
||||||
//
|
|
||||||
// Also, QuickDraw (MacOS) does not support line styles specifically,
|
|
||||||
// and the hack we use in fl_line_style() will not draw horizontal lines
|
|
||||||
// on odd-numbered rows...
|
|
||||||
int i, xx, yy;
|
|
||||||
|
|
||||||
X += Fl::box_dx(B);
|
X += Fl::box_dx(B);
|
||||||
Y += Fl::box_dy(B);
|
Y += Fl::box_dy(B);
|
||||||
W -= Fl::box_dw(B) + 2;
|
W -= Fl::box_dw(B)+1;
|
||||||
H -= Fl::box_dh(B) + 2;
|
H -= Fl::box_dh(B)+1;
|
||||||
|
fl_color(fl_contrast(fg, bg));
|
||||||
for (xx = 0, i = 1; xx < W; xx ++, i ++) if (i & 1) fl_point(X + xx, Y);
|
fl_focus_rect(X, Y, W, H);
|
||||||
for (yy = 0; yy < H; yy ++, i ++) if (i & 1) fl_point(X + W, Y + yy);
|
|
||||||
for (xx = W; xx > 0; xx --, i ++) if (i & 1) fl_point(X + xx, Y + H);
|
|
||||||
for (yy = H; yy > 0; yy --, i ++) if (i & 1) fl_point(X, Y + yy);
|
|
||||||
#endif*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return the item's 'visible' height. Takes into account the item's:
|
/// Return the item's 'visible' height. Takes into account the item's:
|
||||||
|
|||||||
Reference in New Issue
Block a user