Remove unnecessary Fl_Widget_Tracker from Fl_Dial's handle().

handle_push() doesn't call a callback, hence Fl_Widget_Tracker is not
necessary.

Added FALLTHROUGH and NOTREACHED comments.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12279 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Albrecht Schlosser 2017-06-29 01:13:05 +00:00
parent 14a6e9d103
commit c6c4e8d426

View File

@ -103,10 +103,9 @@ void Fl_Dial::draw() {
*/
int Fl_Dial::handle(int event, int X, int Y, int W, int H) {
switch (event) {
case FL_PUSH: {
Fl_Widget_Tracker wp(this);
case FL_PUSH:
handle_push();
if (wp.deleted()) return 1; }
/* FALLTHROUGH */
case FL_DRAG: {
int mx = (Fl::event_x()-X-W/2)*H;
int my = (Fl::event_y()-Y-H/2)*W;
@ -124,12 +123,13 @@ int Fl_Dial::handle(int event, int X, int Y, int W, int H) {
val = minimum() + (maximum()-minimum())*(angle-a1)/(a2-a1);
}
handle_drag(clamp(round(val)));
} return 1;
return 1;
} /* NOTREACHED */
case FL_RELEASE:
handle_release();
return 1;
case FL_ENTER : /* FALLTHROUGH */
case FL_LEAVE :
case FL_ENTER: /* FALLTHROUGH */
case FL_LEAVE:
return 1;
default:
return 0;
@ -163,8 +163,7 @@ Fl_Fill_Dial::Fl_Fill_Dial(int X,int Y,int W,int H, const char *L)
Fl_Line_Dial::Fl_Line_Dial(int X,int Y,int W,int H, const char *L)
: Fl_Dial(X,Y,W,H,L)
{
: Fl_Dial(X,Y,W,H,L) {
type(FL_LINE_DIAL);
}