diff --git a/Frame.C b/Frame.C index a52d314..6999bdd 100644 --- a/Frame.C +++ b/Frame.C @@ -17,6 +17,11 @@ #include #include #include +#if FL_API_VERSION >= 10400 +# if FLTK_USE_CAIRO +# include +# endif +#endif #ifndef HAVE_XFT #include "Rotated.H" // text rotation code; not supported by non-Xft FLTK 1.3.x @@ -24,6 +29,8 @@ // From Hotkeys.C extern void ToggleWinMax(void); +void ToggleVertMax(void); +extern void ToggleHorzMax(void); static Atom wm_state = 0; static Atom wm_change_state; @@ -92,11 +99,11 @@ Frame::Frame(XWindow window, XWindowAttributes* existing) : transient_for_(0), revert_to(active_), colormapWinCount(0), - close_button(BUTTON_LEFT,BUTTON_TOP,BUTTON_W,BUTTON_H,"X"), - iconize_button(BUTTON_LEFT,BUTTON_TOP,BUTTON_W,BUTTON_H,"i"), - max_h_button(BUTTON_LEFT,BUTTON_TOP+3*BUTTON_H,BUTTON_W,BUTTON_H,"h"), - max_w_button(BUTTON_LEFT,BUTTON_TOP+BUTTON_H,BUTTON_W,BUTTON_H,"w"), - min_w_button(BUTTON_LEFT,BUTTON_TOP+2*BUTTON_H,BUTTON_W,BUTTON_H,"W") + close_button(left,top,ButtonSz,ButtonSz,"X"), + max_w_button(left,top+ButtonSz,ButtonSz,ButtonSz,"w"), + min_w_button(left,top+2*ButtonSz,ButtonSz,ButtonSz,"W"), + max_h_button(left,top+3*ButtonSz,ButtonSz,ButtonSz,"h"), + iconize_button(left,top+4*ButtonSz,ButtonSz,ButtonSz,"i") { close_button.callback(button_cb_static); iconize_button.callback(button_cb_static); @@ -454,7 +461,7 @@ int Frame::force_x_onscreen(int X, int W) { X = min(X, Root->x()+Root->w()-W+dwidth-left); if (W-dwidth > Root->w() || h()-dheight > Root->h()) // windows bigger than the screen need title bar so they can move - X = max(X, Root->x()-LEFT); + X = max(X, Root->x()-LftSz); else X = max(X, Root->x()-left); return X; @@ -506,8 +513,12 @@ Frame::~Frame() { //////////////////////////////////////////////////////////////// void Frame::getLabel(int del) { + int clr_h = label_h; + int clr_w = label_w; char* old = (char*)label(); char* nu = del ? 0 : (char*)getProperty(XA_WM_NAME); + //int clr_pix = max(fl_width(nu), fl_width(old)) + RgtSz; + //Fl::error("getLabel(): old title '%s'; new title '%s'; clr pix %d", old, nu, clr_pix); if (nu) { // since many window managers print a default label when none is // given, many programs send spaces to make a blank label. Detect @@ -521,25 +532,29 @@ void Frame::getLabel(int del) { } else { if (!nu) return; } -#ifdef TOPSIDE Fl_Widget::label(nu); if (nu) { - fl_font(TITLE_FONT_SLOT, TITLE_FONT_SIZE); - label_h = int(fl_size())+6; - } else - label_h = 0; - if (shown())// && label_w > 3 && top > 3) - XClearArea(fl_display, fl_xid(this), label_x, BUTTON_TOP, label_w, label_h, 1); + fl_font(TITLE_FONT_SLOT, TitleFontSz); + int lbl_pix = fl_width(nu); +#ifdef TOPSIDE + label_h = (int)fl_size() + TopSz + 1; + label_w = lbl_pix + RgtSz; + clr_h = label_h; + clr_w = w() - RgtSz; // clr_pix; #else - Fl_Widget::label(nu); - if (nu) { - fl_font(TITLE_FONT_SLOT, TITLE_FONT_SIZE); - label_w = int(fl_width(nu))+6; - } else - label_w = 0; - if (shown() && label_h > 3 && left > 3) - XClearArea(fl_display, fl_xid(this), 1, label_y+3, left-1, label_h-3, 1); + label_w = (int)fl_size() + LftSz + 1; + label_h = lbl_pix + TopSz + BtmSz; + clr_h = h() - BtmSz; + clr_w = label_w; #endif + } else { + label_h = 0; + label_w = 0; + } + if (shown()) { // && label_h > 3 && left > 3) + XClearArea(fl_display, fl_xid(this), LftSz, TopSz, clr_w, clr_h, 1); + //Fl::error("getLabel(): clearing w %d, h %d", clr_w, clr_h); + } } //////////////////////////////////////////////////////////////// @@ -591,9 +606,9 @@ int Frame::getSizes() { min_h = H; // guess a value for minimum size in case it is not set anywhere: - min_w = min(min_w, 4*BUTTON_H); + min_w = min(min_w, 4*ButtonSz); min_w = ((min_w+inc_w-1)/inc_w) * inc_w; - min_h = min(min_h, 4*BUTTON_H); + min_h = min(min_h, 4*ButtonSz); min_h = ((min_h+inc_h-1)/inc_h) * inc_h; // some programs put the minimum size here: if (sizeHints.flags & PBaseSize) { @@ -1061,6 +1076,7 @@ void Frame::desktop(Desktop* d) { void Frame::set_size(int nx, int ny, int nw, int nh, int warp) { int dx = nx-x(); x(nx); int dy = ny-y(); y(ny); + //Fl::error("Frame::set_size(): wnd %X, nx %d, ny %d, nw %d, nh %d; dheight %d, dx %d, dy %d", window_, nw, nh, dheight, dx, dy); if (!dx && !dy && nw == w() && nh == h()) return; int unmap = 0; int remap = 0; @@ -1076,12 +1092,22 @@ void Frame::set_size(int nx, int ny, int nw, int nh, int warp) { int minw = (nw < w()) ? nw : w(); XClearArea(fl_display, fl_xid(this), minw-RIGHT, 0, RIGHT, nh, 1); w(nw); -#ifdef TOPSIDE - show_hide_buttons(); -#endif +//#ifdef TOPSIDE +// show_hide_buttons(); +//#endif } if (nh != h()) { max_h_button.value(nh-dheight == maximize_height()); +#ifdef TOPSIDE + // min_w_button is used for rollup windowshade effect + min_w_button.value(nh <= dheight); + if (nh <= dheight) { + unmap = 1; + } else { + if (h() <= dheight) remap = 1; + } +#endif + int minh = (nh < h()) ? nh : h(); XClearArea(fl_display, fl_xid(this), 0, minh-BOTTOM, w(), BOTTOM, 1); // see if label or close box moved, erase the minimum area: @@ -1091,10 +1117,10 @@ void Frame::set_size(int nx, int ny, int nw, int nh, int warp) { #if 1 //def SHOW_CLOCK #ifdef TOPSIDE //int t = label_x + 3; // we have to clear the entire label area + //Fl::error("XClearArea(): id %X, x %d, y %d, w %d, h %d", fl_xid(this), label_x, BUTTON_TOP, label_x + label_w, BUTTON_H); XClearArea(fl_display,fl_xid(this), label_x, BUTTON_TOP, label_x + label_w, BUTTON_H, 1); // ML #else - show_hide_buttons(); //int t = label_y + 3; // we have to clear the entire label area XClearArea(fl_display,fl_xid(this), 1, label_y, left-1, nh-label_y, 1); // ML #endif @@ -1110,20 +1136,35 @@ void Frame::set_size(int nx, int ny, int nw, int nh, int warp) { //ML if (t < nh && left>LEFT) //ML XClearArea(fl_display,fl_xid(this), 1, t, left-1, nh-t, 1); } + show_hide_buttons(); // for maximize button move the cursor first if window gets smaller if (warp == 1 && !DoNotWarp && (dx || dy)) XWarpPointer(fl_display, None,None,0,0,0,0, dx, dy); // for configure request, move the cursor first if (warp == 2 && active() && !Fl::pushed()) warp_pointer(); + if (ny < 0) ny = 0; + if (nh < 8) nh = 8; // TitleSz; + + //Fl::error("XMoveResizeWindow(): id %X, x %d, y %d, w %d, h %d", fl_xid(this), nx, ny, nw, nh); XMoveResizeWindow(fl_display, fl_xid(this), nx, ny, nw, nh); - if (nw <= dwidth) { +#if FL_API_VERSION >= 10400 +# if FLTK_USE_CAIRO + make_current(); + //Fl::error("cairo_xlib_surface_set_size(): gc %X, w %d, h %d", fl_cairo_gc(), nw, nh); + if (fl_cairo_gc()) cairo_xlib_surface_set_size(cairo_get_target(fl_cairo_gc()), nw, nh); +# endif +#endif + if (nw <= dwidth || nh <= dheight) { if (unmap) { set_state_flag(IGNORE_UNMAP); + //Fl::error("XUnmapWindow(): wnd %X", window_); XUnmapWindow(fl_display, window_); } } else { + //Fl::error("XResizeWindow(): wnd %X, w %d, h %d", window_, nw-dwidth, nh-dheight); XResizeWindow(fl_display, window_, nw-dwidth, nh-dheight); if (remap) { + //Fl::error("XMapWindow(): wnd %X", window_); XMapWindow(fl_display, window_); #if CLICK_TO_TYPE if (active()) activate(); @@ -1148,9 +1189,12 @@ void Frame::sendConfigureNotify() const { ce.y = y()+top-app_border_width; ce.width = w()-dwidth; ce.height = h()-dheight; +// if (ce.height < TitleSz) ce.height = TitleSz; + if (ce.height < 8) ce.height = 8; ce.border_width = app_border_width; ce.above = None; ce.override_redirect = 0; + //Fl::error("XSendEvent(): wnd %X, x %d, y %d, w %d, h %d", window_, ce.x, ce.y, ce.width, ce.height); XSendEvent(fl_display, window_, False, StructureNotifyMask, (XEvent*)&ce); } @@ -1180,15 +1224,15 @@ void Frame::updateBorder() { left = top = dwidth = dheight = 0; } else { #ifdef TOPSIDE - left = LEFT; - dwidth = left+RIGHT; - top = flag(THIN_BORDER) ? TOP : TOP+TITLE_HEIGHT; - dheight = top+BOTTOM; + left = LftSz; + dwidth = left+RgtSz; + top = flag(THIN_BORDER) ? TopSz : TopSz+TitleSz; + dheight = top+BtmSz; #else - left = flag(THIN_BORDER) ? LEFT : LEFT+TITLE_WIDTH; - dwidth = left+RIGHT; - top = TOP; - dheight = TOP+BOTTOM; + left = flag(THIN_BORDER) ? LftSz : LftSz+TitleSz; + dwidth = left+RgtSz; + top = TopSz; + dheight = top+BtmSz; #endif } nx -= left; @@ -1222,18 +1266,21 @@ void Frame::show_hide_buttons() { close_button.hide(); return; } - int bx = BUTTON_LEFT; + int bx = left; + int lbl_pix = fl_width(label()); + label_w = lbl_pix + LftSz; // RS: ICONIZE BUTTON IS TOP LEFT -- - if (transient_for()) { + if (transient_for() || label_w > (w() - (3*ButtonSz + LftSz + 2*RgtSz))) { // don't show iconize button for "transient" (e.g. dialog box) windows iconize_button.hide(); + label_x = 2*LftSz; } else { iconize_button.show(); - iconize_button.position(BUTTON_LEFT, BUTTON_TOP); + iconize_button.position(left, TopSz); } // ML: OTHER BUTTONS ARE PLACED IN UPPER RIGHT - bx = w() - BUTTON_RIGHT - BUTTON_W; + bx = w() - RgtSz - ButtonSz; // RS: FIRST PLACE CLOSE BUTTON FARTHEST INTO UPPER RIGHT #if CLOSE_BOX @@ -1243,37 +1290,45 @@ void Frame::show_hide_buttons() { #if CLOSE_BOX } else { close_button.show(); - close_button.position(bx, BUTTON_TOP); - bx -= BUTTON_W; + close_button.position(bx, TopSz); + bx -= ButtonSz; } #endif - if (transient_for()) { + if (transient_for() || label_w > (w() - (2*ButtonSz + LftSz + 2*RgtSz))) { // don't show resize and iconize buttons for "transient" (e.g. dialog box) windows - max_w_button.hide(); + min_w_button.hide(); + } else { + min_w_button.position(bx, TopSz); + min_w_button.show(); + bx -= ButtonSz; + } + + if (transient_for() || flag(KEEP_ASPECT|NO_RESIZE) || + label_w > (w() - (4*ButtonSz + LftSz + 2*RgtSz))) { max_h_button.hide(); } else { - max_h_button.position(bx, BUTTON_TOP); + max_h_button.position(bx, TopSz); max_h_button.show(); - bx -= BUTTON_W; - max_w_button.position(bx, BUTTON_TOP); + bx -= ButtonSz; + } + + if (transient_for() || flag(KEEP_ASPECT|NO_RESIZE) || + label_w > (w() - (5*ButtonSz + LftSz + 2*RgtSz))) { + max_w_button.hide(); + } else { + max_w_button.position(bx, TopSz); max_w_button.show(); - bx -= BUTTON_W; + bx -= ButtonSz; } - if (!transient_for()) { - iconize_button.position(bx, BUTTON_TOP); - iconize_button.show(); - bx -= BUTTON_W; - } - else { - iconize_button.hide(); - - } if (label_x != bx && shown()) //ML Buttons look garbled after expanding, so let's just clear the whole area - XClearArea(fl_display,fl_xid(this), LEFT, TOP, w() - LEFT, TITLE_HEIGHT, 1); - label_x = BUTTON_LEFT + left; - label_w = bx - label_x; + XClearArea(fl_display,fl_xid(this), LftSz, TopSz, w() - LftSz, TitleSz, 1); + label_x = LftSz + ButtonSz + 2*RgtSz; + if (label_w > (w() - (LftSz + 3*ButtonSz + 2*RgtSz))) { + label_x = LftSz + RgtSz; // move to where iconize button would be + } +// label_w = bx - label_x; } @@ -1288,7 +1343,7 @@ void Frame::show_hide_buttons() { close_button.hide(); return; } - int by = BUTTON_TOP; + int by = top; // ML CLOSE BUTTON IS NOW TOP LEFT -- #if CLOSE_BOX @@ -1298,33 +1353,41 @@ void Frame::show_hide_buttons() { #if CLOSE_BOX } else { close_button.show(); - close_button.position(BUTTON_LEFT,by); - by += BUTTON_H; + close_button.position(LftSz,by); + by += ButtonSz; } #endif - if (!transient_for()) { - min_w_button.position(BUTTON_LEFT,by); - min_w_button.show(); - by += BUTTON_H; + int lbl_pix = fl_width(label()); + label_h = lbl_pix + TopSz + BtmSz; + if (label_h > (h() - (ButtonSz + TopSz + 2*BtmSz))) { + label_h = h() - (ButtonSz + TopSz + 2*BtmSz); // clip to whatever we can still squeeze in } - else { + if (transient_for() || + (h() < (label_h + 2*ButtonSz + TopSz + 2*BtmSz))) { min_w_button.hide(); } + else { + min_w_button.position(LftSz,by); + min_w_button.show(); + by += ButtonSz; + } if ((min_h == max_h) || flag(KEEP_ASPECT|NO_RESIZE) || - (!max_h_button.value() && ((by+label_w+2*BUTTON_H) > (h()-BUTTON_BOTTOM)))) { + (h() < (label_h + 4*ButtonSz + TopSz + 2*BtmSz)) || + (!max_h_button.value() && ((by+label_w+2*BUTTON_H) > (h()-BUTTON_BOTTOM)))) { max_h_button.hide(); } else { - max_h_button.position(BUTTON_LEFT,by); + max_h_button.position(LftSz,by); max_h_button.show(); - by += BUTTON_H; + by += ButtonSz; } - if ((min_w == max_w) || flag(KEEP_ASPECT|NO_RESIZE) || - (!max_w_button.value() && ((by+label_w+2*BUTTON_H > h()-BUTTON_BOTTOM)))) { + if ( (min_w == max_w) || flag(KEEP_ASPECT|NO_RESIZE) || + (h() < (label_h + 5*ButtonSz + TopSz + 2*BtmSz)) || + (!max_w_button.value() && ((by+label_w+2*BUTTON_H > h()-BUTTON_BOTTOM)))) { max_w_button.hide(); } else { - max_w_button.position(BUTTON_LEFT,by); + max_w_button.position(LftSz,by); max_w_button.show(); - by += BUTTON_H; + by += ButtonSz; } if (label_y != by && shown()) //ML XClearArea(fl_display,fl_xid(this), 1, by, left-1, label_h+label_y-by, 1); @@ -1333,13 +1396,13 @@ void Frame::show_hide_buttons() { label_y = by; //ML MOVED ICONIZE BUTTON TO BOTTOM -- - if (by+BUTTON_H > h()-BUTTON_BOTTOM || transient_for()) { - label_h = h()-BOTTOM-by; + if (by+ButtonSz > h()-BtmSz || transient_for() || (h() < (label_h + 3*ButtonSz + TopSz + 2*BtmSz))) { + label_y = h()-TopSz-2*BtmSz-label_h; iconize_button.hide(); } else { iconize_button.show(); - iconize_button.position(BUTTON_LEFT,h()-(BUTTON_BOTTOM+BUTTON_H)); - label_h = iconize_button.y()-by; + iconize_button.position(LftSz,h()-(BtmSz+ButtonSz+TopSz)); + //label_h = iconize_button.y()-by-TopSz; } // -- END ML @@ -1419,8 +1482,8 @@ void Frame::draw() { #endif if (!flag(THIN_BORDER) && label_h > 3) { fl_color(labelcolor()); - fl_font(TITLE_FONT_SLOT, TITLE_FONT_SIZE); - fl_draw(label(), label_x, BUTTON_TOP, label_w, BUTTON_H, + fl_font(TITLE_FONT_SLOT, TitleFontSz); // TITLE_FONT_SIZE); + fl_draw(label(), label_x, TopSz, label_w, ButtonSz, Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_CLIP), 0, 0); } } @@ -1457,8 +1520,8 @@ void Frame::draw() { if (active()) { int clkw = int(fl_width(clock_buf)); if (clock_alarm_on) { - fl_font(TITLE_FONT_SLOT, TITLE_FONT_SIZE); - fl_rectf(LEFT-1, label_y + label_h - 3 - clkw, TITLE_WIDTH, clkw, + fl_font(TITLE_FONT_SLOT, TitleFontSz); //TITLE_FONT_SIZE); + fl_rectf(LftSz-1, label_y + label_h - 3 - clkw, TitleSz, clkw, (ALARM_BG_COLOR>>16)&0xff, (ALARM_BG_COLOR>>8)&0xff, ALARM_BG_COLOR&0xff); @@ -1466,7 +1529,7 @@ void Frame::draw() { (ALARM_FG_COLOR>>8)&0xff, ALARM_FG_COLOR&0xff); } else - fl_font(MENU_FONT_SLOT, TITLE_FONT_SIZE); + fl_font(MENU_FONT_SLOT, TitleFontSz); //TITLE_FONT_SIZE); #ifndef HAVE_XFT // This might overlay the label if the label is long enough @@ -1485,7 +1548,7 @@ void Frame::draw() { left-1, label_h-3, 0); #endif fl_color(labelcolor()); - fl_font(TITLE_FONT_SLOT, TITLE_FONT_SIZE); + fl_font(TITLE_FONT_SLOT, TitleFontSz); //TITLE_FONT_SIZE); if(label() && *label()) #ifndef HAVE_XFT draw_rotated90(label(), 1, label_y+3, left-1, label_h-3, @@ -1517,17 +1580,22 @@ void FrameButton::draw() { value() ? fl_darker(FL_BACKGROUND2_COLOR) : fl_color_average(FL_BACKGROUND2_COLOR, FL_WHITE, 0.6)); // ML // Fl_Widget::draw_box(value() ? FL_DOWN_FRAME : FL_UP_FRAME, FL_GRAY); + fl_line_style(FL_SOLID, (int)(sf + 0.7)); fl_color(parent()->labelcolor()); switch (label()[0]) { case 'W': +#ifdef TOPSIDE + fl_line (x+3, y+5, x+w()-4, y+5); +#else fl_rect(x+(h()-7)/2,y+3,2,h()-6); - return; +#endif + break; case 'w': - fl_rect(x+2,y+(h()-7)/2,w()-4,7); - return; + fl_rect(x+3,y+(h()-7)/2,w()-4,7); + break; case 'h': fl_rect(x+(h()-7)/2,y+2,7,h()-4); - return; + break; case 'X': #if CLOSE_X fl_line(x+2,y+3,x+w()-5,y+h()-4); @@ -1539,13 +1607,14 @@ void FrameButton::draw() { fl_arc(x+3,y+3,w()-6,h()-6,0,360); fl_line(x+7,y+3, x+7,y+11); #endif - return; + break; case 'i': #if ICONIZE_BOX - fl_line (x+2, y+(h()-4), x+w()-4, y+h()-4); + fl_line (x+3, y+(h()-4), x+w()-4, y+h()-4); #endif - return; + break; } + fl_line_style(FL_SOLID, 1); } //////////////////////////////////////////////////////////////// @@ -1556,47 +1625,59 @@ void Frame::button_cb(Fl_Button* b) { switch (b->label()[0]) { case 'W': // minimize button if (b->value()) { +#ifdef TOPSIDE + if (!max_h_button.value()) { +#else if (!max_w_button.value()) { - restore_x = x()+left; - restore_y = y()+top; +#endif + restore_x = x(); //+left; + restore_y = y(); // +top; #if MINIMIZE_HEIGHT - restore_w=w()-dwidth; - restore_h = h()-dwidth; + restore_w = w(); //-dwidth; + restore_h = h(); //-dheight; #endif } -#if MINIMIZE_HEIGHT + #ifdef TOPSIDE - set_size(x(), y(), dwidth-1, 350,1);// <-- crude hack for now -#else - set_size(x(), y(), dwidth-1, - min(h(),min(350,label_w+3*BUTTON_H+BUTTON_TOP+BUTTON_BOTTOM)), - 1); -#endif // not topside -#else +#if MINIMIZE_HEIGHT // minimize rollup/windowblind size + set_size(x(), y(), min(w(),label_w+5*ButtonSz+2*LftSz+2*RgtSz), dheight-3, 1); +#else // don't minimize rollup/windowblind size + set_size(x(), y(), w(), dheight-3, 1); +#endif +#else // not TOPSIDE +#if MINIMIZE_HEIGHT // minimize rollup/windowblind size + set_size(x(), y(), dwidth-1, min(h(),label_h+5*ButtonSz+2*TopSz+2*BtmSz), 1); +#else // don't minimize rollup/windowblind size set_size(x(), y(), dwidth-1, h(), 1); +#endif #endif } else { #if MINIMIZE_HEIGHT - set_size(x(), y(), restore_w+dwidth, restore_h+dwidth, 1); + set_size(restore_x, restore_y, restore_w+dwidth, restore_h+dwidth, 1); #else - set_size(x(), y(), restore_w+dwidth, h(), 1); +#ifdef TOPSIDE + set_size(restore_x, restore_y, w(), h(), 1); +#else // not TOPSIDE + set_size(restore_x, restore_y, restore_w+dwidth, h(), 1); +#endif #endif } show_hide_buttons(); break; case 'w': // max-width button - if (b->value()) { +/* if (b->value()) { if (!min_w_button.value()) {restore_x=x()+left; restore_w=w()-dwidth;} int W = maximize_width()+dwidth; int X = force_x_onscreen(x() + (w()-W)/2, W); set_size(X, y(), W, h(), 3); } else { set_size(restore_x-left, y(), restore_w+dwidth, h(), 1); - } + } */ + ToggleHorzMax(); show_hide_buttons(); break; case 'h': // max-height button - if (b->value()) { +/* if (b->value()) { restore_y = y()+top; restore_h = h()-dwidth; int H = maximize_height()+dheight; @@ -1604,7 +1685,9 @@ void Frame::button_cb(Fl_Button* b) { set_size(x(), Y, w(), H, 3); } else { set_size(x(), restore_y-top, w(), restore_h+dwidth, 1); - } + }*/ + ToggleVertMax(); + show_hide_buttons(); break; case 'X': close(); diff --git a/Frame.H b/Frame.H index 9d45411..a138833 100644 --- a/Frame.H +++ b/Frame.H @@ -102,10 +102,10 @@ class Frame : public Fl_Window { Desktop* desktop_; FrameButton close_button; - FrameButton iconize_button; - FrameButton max_h_button; FrameButton max_w_button; FrameButton min_w_button; + FrameButton max_h_button; + FrameButton iconize_button; int maximize_width(); int maximize_height(); diff --git a/Hotkeys.C b/Hotkeys.C index 1ed0d5b..e8c36e9 100644 --- a/Hotkeys.C +++ b/Hotkeys.C @@ -225,7 +225,7 @@ static void GrowShorter(void) { // Ctrl+Alt+PageDn GrowFrame(0, -1); } -static void ToggleVertMax(void) {// Ctrl+Alt+V +void ToggleVertMax(void) {// Ctrl+Alt+V static int nonmax_h = Fl::h() - 64; static int nonmax_y = 32; Frame* f = Frame::activeFrame(); @@ -240,7 +240,7 @@ static void ToggleVertMax(void) {// Ctrl+Alt+V } } -static void ToggleHorzMax(void) {// Ctrl+Alt+H +void ToggleHorzMax(void) {// Ctrl+Alt+H static int nonmax_w = Fl::w() - 64; static int nonmax_x = 32; Frame* f = Frame::activeFrame(); diff --git a/Menu.C b/Menu.C index 9320f45..e963645 100644 --- a/Menu.C +++ b/Menu.C @@ -88,7 +88,7 @@ frame_label_draw(const Fl_Label* o, int X, int Y, int W, int H, Fl_Align align) fl_rectf(X+x+SCREEN_DX, Y+y+SCREEN_DX, w, h); } } - fl_font(o->font, o->size); + fl_font(o->font, TitleFontSz); // o->size); fl_color((Fl_Color)o->color); const char* l = f->label(); if (!l) l = "unnamed"; // double any ampersands to turn off the underscores: @@ -111,7 +111,7 @@ frame_label_measure(const Fl_Label* o, int& W, int& H) Frame* f = (Frame*)(o->value); if (window_deleted(f)) {W = MENU_ICON_W+3; H = MENU_ICON_H; return;} const char* l = f->label(); if (!l) l = "unnamed"; - fl_font(o->font, o->size); + fl_font(o->font, TitleFontSz); // o->size); fl_measure(l, W, H); W += MENU_ICON_W+3; if (W > MAX_MENU_WIDTH) W = MAX_MENU_WIDTH; @@ -124,7 +124,7 @@ frame_label_measure(const Fl_Label* o, int& W, int& H) static void label_draw(const Fl_Label* o, int X, int Y, int W, int H, Fl_Align align) { - fl_font(o->font, o->size); + fl_font(o->font, TitleFontSz); // o->size); fl_color((Fl_Color)o->color); fl_draw(o->value, X+MENU_ICON_W+3, Y, W-MENU_ICON_W-3, H, align); } @@ -132,7 +132,7 @@ label_draw(const Fl_Label* o, int X, int Y, int W, int H, Fl_Align align) static void label_measure(const Fl_Label* o, int& W, int& H) { - fl_font(o->font, o->size); + fl_font(o->font, TitleFontSz); // o->size); fl_measure(o->value, W, H); W += MENU_ICON_W+3; if (W > MAX_MENU_WIDTH) W = MAX_MENU_WIDTH; @@ -289,7 +289,7 @@ init(Fl_Menu_Item& m, const char* data) m.labeltype(FL_NORMAL_LABEL); m.shortcut(0); m.labelfont(MENU_FONT_SLOT); - m.labelsize(MENU_FONT_SIZE); + m.labelsize(TitleFontSz); // MENU_FONT_SIZE); m.labelcolor(FL_FOREGROUND_COLOR); } diff --git a/Rotated.C b/Rotated.C.deprecated similarity index 100% rename from Rotated.C rename to Rotated.C.deprecated diff --git a/Rotated.H b/Rotated.H.deprecated similarity index 100% rename from Rotated.H rename to Rotated.H.deprecated diff --git a/config.h b/config.h index b3d40eb..c3e0136 100644 --- a/config.h +++ b/config.h @@ -113,14 +113,13 @@ // thickness of the border edge on each side (includes XBORDER): #define LEFT 3 #define RIGHT 4 -#define TOP 3 +#define TOP 2 #define BOTTOM 4 // font for titles (if not set, helvetica bold is used): // If this name is specific enough the font size is ignored. -#define TITLE_FONT "-*-helvetica-medium-r-normal--*" -#define TITLE_FONT_SIZE 12 - +//#define TITLE_FONT "-*-helvetica-medium-r-normal--*" +#define TITLE_FONT_SIZE 14 // thickness of title bar (frame border thickness is added to it): #define TITLE_WIDTH (TITLE_FONT_SIZE+1) #ifdef TOPSIDE @@ -142,6 +141,15 @@ #define BUTTON_BOTTOM BOTTOM #endif +extern int TitleFontSz; +extern int TitleSz; +extern int ButtonSz; +extern int LftSz; +extern int RgtSz; +extern int TopSz; +extern int BtmSz; +extern float sf; //scale factor from Xft.dpi + // how many pixels from edge for resize handle: #define RESIZE_EDGE 5 // set this to zero to disable resizing by grabbing left/top edge: @@ -195,8 +203,8 @@ #define MENU_ICON_H 15 // font to use in menus (if not set helvetica is used): -#define MENU_FONT "-*-helvetica-medium-r-normal--*" -#define MENU_FONT_SIZE 12 +//#define MENU_FONT "-*-helvetica-medium-r-normal--*" +#define MENU_FONT_SIZE 14 //////////////////////////////////////////////////////////////// // You probably don't want to change any of these: diff --git a/main.C b/main.C index 6f4b9fd..731d1eb 100644 --- a/main.C +++ b/main.C @@ -28,6 +28,15 @@ //ML #include #include +int TitleFontSz = TITLE_FONT_SIZE; +int TitleSz = TITLE_FONT_SIZE + 4; +int ButtonSz = TitleSz; +int LftSz = LEFT; +int RgtSz = RIGHT; +int TopSz = TOP; +int BtmSz = BOTTOM; +float sf = 1.0; + //////////////////////////////////////////////////////////////// @@ -420,9 +429,21 @@ int main(int argc, char** argv) { DoNotWarp=1; // Then keep your hands off of my mouse pointer. #ifndef FL_NORMAL_SIZE // detect new versions of fltk where this is a variable - FL_NORMAL_SIZE = 12; + FL_NORMAL_SIZE = 14; #endif + fl_open_display(); + sf = Fl::screen_scale(0); + TitleFontSz = (int) ((float)TITLE_FONT_SIZE * sf); + TitleSz = (int) ((float)(TITLE_FONT_SIZE + 4) * sf); + ButtonSz = TitleSz; + LftSz = (int) ((float)LEFT * sf); + RgtSz = (int) ((float)RIGHT * sf); + TopSz = (int) ((float)TOP * sf); + BtmSz = (int) ((float)BOTTOM * sf); + + for (int i = 0; i < Fl::screen_count(); i++) Fl::screen_scale(i, 1.0); + color_setup(CURSOR_FG_SLOT, cfg, CURSOR_FG_COLOR<<8); color_setup(CURSOR_BG_SLOT, cbg, CURSOR_BG_COLOR<<8); Fl::set_color(FL_SELECTION_COLOR,0,0,128);