From 452a410a3ea02f58930c4b3cc5a04bbb6b3e7070 Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Sat, 2 Feb 2019 17:47:55 +0100 Subject: STR #2714: remove new shadow lint for MacOS --- src/Fl_File_Chooser2.cxx | 6 +-- src/Fl_Graphics_Driver.cxx | 4 +- src/Fl_MacOS_Sys_Menu_Bar.mm | 16 +++---- src/Fl_Menu.cxx | 24 ++++++----- src/Fl_Screen_Driver.cxx | 6 +-- src/Fl_Tabs.cxx | 4 +- src/Fl_Tooltip.cxx | 12 +++--- src/Fl_Tree_Item.cxx | 10 ++--- src/Fl_Widget_Surface.cxx | 20 ++++----- src/Fl_Window.cxx | 50 +++++++++++----------- src/Fl_cocoa.mm | 12 +++--- src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx | 10 ++--- src/drivers/PostScript/Fl_PostScript.cxx | 10 ++--- .../Quartz/Fl_Quartz_Graphics_Driver_font.cxx | 4 +- .../Quartz/Fl_Quartz_Graphics_Driver_image.cxx | 4 +- .../Fl_Quartz_Graphics_Driver_line_style.cxx | 16 +++---- src/fl_curve.cxx | 10 ++--- src/fl_draw_pixmap.cxx | 14 +++--- src/fl_file_dir.cxx | 6 +-- 19 files changed, 120 insertions(+), 118 deletions(-) (limited to 'src') diff --git a/src/Fl_File_Chooser2.cxx b/src/Fl_File_Chooser2.cxx index 426dbfd51..80d842bcf 100644 --- a/src/Fl_File_Chooser2.cxx +++ b/src/Fl_File_Chooser2.cxx @@ -798,9 +798,9 @@ Fl_File_Chooser::fileNameCB() } // Make sure we have an absolute path... - int condition = directory_[0] != '\0' && filename[0] != '/'; - if (condition && Fl::system_driver()->colon_is_drive()) condition = !(isalpha(filename[0] & 255) && (!filename[1] || filename[1] == ':')); - if (condition) { + int dirIsRelative = directory_[0] != '\0' && filename[0] != '/'; + if (dirIsRelative && Fl::system_driver()->colon_is_drive()) dirIsRelative = !(isalpha(filename[0] & 255) && (!filename[1] || filename[1] == ':')); + if (dirIsRelative) { fl_filename_absolute(pathname, sizeof(pathname), filename); value(pathname); fileName->mark(fileName->position()); // no selection after expansion diff --git a/src/Fl_Graphics_Driver.cxx b/src/Fl_Graphics_Driver.cxx index 784e5b5c2..cf7caa1af 100644 --- a/src/Fl_Graphics_Driver.cxx +++ b/src/Fl_Graphics_Driver.cxx @@ -61,9 +61,9 @@ Fl_Graphics_Driver &Fl_Graphics_Driver::default_driver() /** see fl_text_extents() */ -void Fl_Graphics_Driver::text_extents(const char*t, int n, int& dx, int& dy, int& w, int& h) +void Fl_Graphics_Driver::text_extents(const char*t, int nChars, int& dx, int& dy, int& w, int& h) { - w = (int)width(t, n); + w = (int)width(t, nChars); h = - height(); dx = 0; dy = descent(); diff --git a/src/Fl_MacOS_Sys_Menu_Bar.mm b/src/Fl_MacOS_Sys_Menu_Bar.mm index 8b2987d58..eccc70a4f 100644 --- a/src/Fl_MacOS_Sys_Menu_Bar.mm +++ b/src/Fl_MacOS_Sys_Menu_Bar.mm @@ -123,25 +123,25 @@ const char *Fl_Mac_App_Menu::quit = "Quit %@"; [self setState:(item->value() ? NSOnState : NSOffState)]; } else if ( item->flags & FL_MENU_RADIO ) { // update the menu radio symbols - NSMenu* menu = [self menu]; - NSInteger flRank = [menu indexOfItem:self]; - NSInteger last = [menu numberOfItems] - 1; + NSMenu* this_menu = [self menu]; + NSInteger flRank = [this_menu indexOfItem:self]; + NSInteger last = [this_menu numberOfItems] - 1; int from = flRank; while(from > 0) { - if ([[menu itemAtIndex:from-1] isSeparatorItem]) break; - item = [(FLMenuItem*)[menu itemAtIndex:from-1] getFlItem]; + if ([[this_menu itemAtIndex:from-1] isSeparatorItem]) break; + item = [(FLMenuItem*)[this_menu itemAtIndex:from-1] getFlItem]; if ( !(item->flags & FL_MENU_RADIO) ) break; from--; } int to = flRank; while (to < last) { - if ([[menu itemAtIndex:to+1] isSeparatorItem]) break; - item = [(FLMenuItem*)[menu itemAtIndex:to+1] getFlItem]; + if ([[this_menu itemAtIndex:to+1] isSeparatorItem]) break; + item = [(FLMenuItem*)[this_menu itemAtIndex:to+1] getFlItem]; if (!(item->flags & FL_MENU_RADIO)) break; to++; } for(int i = from; i <= to; i++) { - NSMenuItem *nsitem = [menu itemAtIndex:i]; + NSMenuItem *nsitem = [this_menu itemAtIndex:i]; [nsitem setState:(nsitem != self ? NSOffState : NSOnState)]; } } diff --git a/src/Fl_Menu.cxx b/src/Fl_Menu.cxx index 3ab303dea..51f6ce15a 100644 --- a/src/Fl_Menu.cxx +++ b/src/Fl_Menu.cxx @@ -1028,30 +1028,32 @@ const Fl_Menu_Item* Fl_Menu_Item::pulldown( The selected item (or NULL if none) is returned. This does not do the callbacks or change the state of check or radio items. - X,Y is the position of the mouse cursor, relative to the + The menu is positioned so the cursor is centered over the item + picked. This will work even if \p picked is in a submenu. + If \p picked is zero or not in the menu item table the menu is + positioned with the cursor in the top-left corner. + + \param[in] X,Y the position of the mouse cursor, relative to the window that got the most recent event (usually you can pass Fl::event_x() and Fl::event_y() unchanged here). - \p title is a character string title for the menu. If + \param[in] title a character string title for the menu. If non-zero a small box appears above the menu with the title in it. - The menu is positioned so the cursor is centered over the item - picked. This will work even if \p picked is in a submenu. - If \p picked is zero or not in the menu item table the menu is - positioned with the cursor in the top-left corner. - - \p button is a pointer to an Fl_Menu_ from which the color and + \param[in] menu_button is a pointer to an Fl_Menu_ from which the color and boxtypes for the menu are pulled. If NULL then defaults are used. + + \return a pointer to the menu item selected by the user, or NULL */ const Fl_Menu_Item* Fl_Menu_Item::popup( int X, int Y, const char* title, const Fl_Menu_Item* picked, - const Fl_Menu_* button - ) const { + const Fl_Menu_* menu_button +) const { static Fl_Menu_Item dummy; // static so it is all zeros dummy.text = title; - return pulldown(X, Y, 0, 0, picked, button, title ? &dummy : 0); + return pulldown(X, Y, 0, 0, picked, menu_button, title ? &dummy : 0); } /** diff --git a/src/Fl_Screen_Driver.cxx b/src/Fl_Screen_Driver.cxx index 1d812a047..2d70187ca 100644 --- a/src/Fl_Screen_Driver.cxx +++ b/src/Fl_Screen_Driver.cxx @@ -192,9 +192,9 @@ Fl_RGB_Image *Fl_Screen_Driver::traverse_to_gl_subwindows(Fl_Group *g, int x, in Fl_RGB_Image *full_img) { if ( g->as_gl_window() ) { - Fl_Device_Plugin *pi = Fl_Device_Plugin::opengl_plugin(); - if (!pi) return full_img; - full_img = pi->rectangle_capture(g, x, y, w, h); + Fl_Device_Plugin *plugin = Fl_Device_Plugin::opengl_plugin(); + if (!plugin) return full_img; + full_img = plugin->rectangle_capture(g, x, y, w, h); } else if ( g->as_window() ) { if (Fl_Window::current() != g) g->as_window()->make_current(); diff --git a/src/Fl_Tabs.cxx b/src/Fl_Tabs.cxx index 353dc49a1..4cfb13401 100644 --- a/src/Fl_Tabs.cxx +++ b/src/Fl_Tabs.cxx @@ -204,7 +204,7 @@ int Fl_Tabs::handle(int event) { return 1; case FL_MOVE: { int ret = Fl_Group::handle(event); - Fl_Widget *o = Fl_Tooltip::current(), *n = o; + Fl_Widget *tooltip_widget = Fl_Tooltip::current(), *n = tooltip_widget; int H = tab_height(); if ( (H>=0) && (Fl::event_y()>y()+H) ) return ret; @@ -214,7 +214,7 @@ int Fl_Tabs::handle(int event) { n = which(Fl::event_x(), Fl::event_y()); if (!n) n = this; } - if (n!=o) + if (n!=tooltip_widget) Fl_Tooltip::enter(n); return ret; } case FL_FOCUS: diff --git a/src/Fl_Tooltip.cxx b/src/Fl_Tooltip.cxx index 06058df6e..b05e036f0 100644 --- a/src/Fl_Tooltip.cxx +++ b/src/Fl_Tooltip.cxx @@ -71,7 +71,7 @@ public: Fl_Widget* Fl_Tooltip::widget_ = 0; static Fl_TooltipBox *window = 0; -static int Y,H; +static int currentTooltipY, currentTooltipH; Fl_Window *Fl_Tooltip::current_window(void) { @@ -88,7 +88,7 @@ void Fl_TooltipBox::layout() { // find position on the screen of the widget: int ox = Fl::event_x_root(); - int oy = Y + H+2; + int oy = currentTooltipY + currentTooltipH+2; for (Fl_Widget* p = Fl_Tooltip::current(); p; p = p->window()) { oy += p->y(); } @@ -96,11 +96,11 @@ void Fl_TooltipBox::layout() { Fl::screen_xywh(scr_x, scr_y, scr_w, scr_h); if (ox+ww > scr_x+scr_w) ox = scr_x+scr_w - ww; if (ox < scr_x) ox = scr_x; - if (H > 30) { + if (currentTooltipH > 30) { oy = Fl::event_y_root()+13; if (oy+hh > scr_y+scr_h) oy -= 23+hh; } else { - if (oy+hh > scr_y+scr_h) oy -= (4+hh+H); + if (oy+hh > scr_y+scr_h) oy -= (4+hh+currentTooltipH); } if (oy < scr_y) oy = scr_y; @@ -277,11 +277,11 @@ void Fl_Tooltip::enter_area(Fl_Widget* wid, int x,int y,int w,int h, const char* return; } // do nothing if it is the same: - if (wid==widget_ /*&& x==X && y==Y && w==W && h==H*/ && t==tip) return; + if (wid==widget_ /*&& x==X && y==currentTooltipY && w==W && h==currentTooltipH*/ && t==tip) return; Fl::remove_timeout(tooltip_timeout); Fl::remove_timeout(recent_timeout); // remember it: - widget_ = wid; Y = y; H = h; tip = t; + widget_ = wid; currentTooltipY = y; currentTooltipH = h; tip = t; // popup the tooltip immediately if it was recently up: if (recent_tooltip) { if (window) window->hide(); diff --git a/src/Fl_Tree_Item.cxx b/src/Fl_Tree_Item.cxx index 666a54674..d78c3427c 100644 --- a/src/Fl_Tree_Item.cxx +++ b/src/Fl_Tree_Item.cxx @@ -1163,17 +1163,17 @@ void Fl_Tree_Item::draw(int X, int &Y, int W, Fl_Tree_Item *itemfocus, int child_w = W - (child_x-X); int child_y_start = Y; for ( int t=0; tdraw(child_x, Y, child_w, itemfocus, tree_item_xmax, lastchild, render); + int is_lastchild = ((t+1)==children()) ? 1 : 0; + _children[t]->draw(child_x, Y, child_w, itemfocus, tree_item_xmax, is_lastchild, render); } if ( has_children() && is_open() ) { Y += prefs.openchild_marginbottom(); // offset below open child tree } if ( ! lastchild ) { // Special 'clipped' calculation. (intentional variable shadowing) - int clipped = ((child_y_start < tree_top) && (Y < tree_top)) || - ((child_y_start > tree_bot) && (Y > tree_bot)); - if (render && !clipped ) + int is_clipped = ((child_y_start < tree_top) && (Y < tree_top)) || + ((child_y_start > tree_bot) && (Y > tree_bot)); + if (render && !is_clipped ) draw_vertical_connector(hconn_x, child_y_start, Y, prefs); } } diff --git a/src/Fl_Widget_Surface.cxx b/src/Fl_Widget_Surface.cxx index 5c6c45432..23597732b 100644 --- a/src/Fl_Widget_Surface.cxx +++ b/src/Fl_Widget_Surface.cxx @@ -68,9 +68,9 @@ void Fl_Widget_Surface::draw(Fl_Widget* widget, int delta_x, int delta_y) // we do some trickery to recognize OpenGL windows and draw them via a plugin int drawn_by_plugin = 0; if (widget->as_gl_window()) { - Fl_Device_Plugin *pi = Fl_Device_Plugin::opengl_plugin(); - if (pi) { - drawn_by_plugin = pi->print(widget); + Fl_Device_Plugin *plugin = Fl_Device_Plugin::opengl_plugin(); + if (plugin) { + drawn_by_plugin = plugin->print(widget); } } if (!drawn_by_plugin) { @@ -177,11 +177,11 @@ int Fl_Widget_Surface::printable_rect(int *w, int *h) {return 1;} /** Draws a window with its title bar and frame if any. - \p x_offset and \p y_offset are optional coordinates of where to position the window top left. + \p win_offset_x and \p win_offset_y are optional coordinates of where to position the window top left. Equivalent to draw() if \p win is a subwindow or has no border. Use Fl_Window::decorated_w() and Fl_Window::decorated_h() to get the size of the window. */ -void Fl_Widget_Surface::draw_decorated_window(Fl_Window *win, int x_offset, int y_offset) +void Fl_Widget_Surface::draw_decorated_window(Fl_Window *win, int win_offset_x, int win_offset_y) { Fl_RGB_Image *top=0, *left=0, *bottom=0, *right=0; if (win->border() && !win->parent()) { @@ -190,22 +190,22 @@ void Fl_Widget_Surface::draw_decorated_window(Fl_Window *win, int x_offset, int int wsides = left ? left->w() : 0; int toph = top ? top->h() : 0; if (top) { - top->draw(x_offset, y_offset); + top->draw(win_offset_x, win_offset_y); delete top; } if (left) { - left->draw(x_offset, y_offset + toph); + left->draw(win_offset_x, win_offset_y + toph); delete left; } if (right) { - right->draw(x_offset + wsides + win->w(), y_offset + toph); + right->draw(win_offset_x + wsides + win->w(), win_offset_y + toph); delete right; } if (bottom) { - bottom->draw(x_offset, y_offset + toph + win->h()); + bottom->draw(win_offset_x, win_offset_y + toph + win->h()); delete bottom; } - this->draw(win, x_offset + wsides, y_offset + toph); + this->draw(win, win_offset_x + wsides, win_offset_y + toph); } // diff --git a/src/Fl_Window.cxx b/src/Fl_Window.cxx index 12445db94..0cde4989d 100644 --- a/src/Fl_Window.cxx +++ b/src/Fl_Window.cxx @@ -587,23 +587,7 @@ int Fl_Window::handle(int ev) /** Sets the allowable range the user can resize this window to. This only works for top-level windows. - - + If this function is not called, FLTK tries to figure out the range from the setting of resizable():