summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fluid/Fl_Group_Type.cxx48
-rw-r--r--fluid/Fl_Menu_Type.cxx20
-rw-r--r--src/Fl.cxx1
-rw-r--r--src/Fl_Browser.cxx6
-rw-r--r--src/Fl_File_Chooser2.cxx4
-rw-r--r--src/Fl_Input_.cxx1
-rw-r--r--src/Fl_Menu.cxx2
-rw-r--r--src/Fl_Text_Buffer.cxx2
8 files changed, 39 insertions, 45 deletions
diff --git a/fluid/Fl_Group_Type.cxx b/fluid/Fl_Group_Type.cxx
index 30c5007dd..6fa4cf867 100644
--- a/fluid/Fl_Group_Type.cxx
+++ b/fluid/Fl_Group_Type.cxx
@@ -337,30 +337,26 @@ void Fl_Table_Type::move_child(Fl_Type* cc, Fl_Type* before) {
Fl_Widget *Fl_Group_Type::enter_live_mode(int) {
Fl_Group *grp = new Fl_Group(o->x(), o->y(), o->w(), o->h());
live_widget = grp;
- if (live_widget) {
- copy_properties();
- Fl_Type *n;
- for (n = next; n && n->level > level; n = n->next) {
- if (n->level == level+1)
- n->enter_live_mode();
- }
- grp->end();
+ copy_properties();
+ Fl_Type *n;
+ for (n = next; n && n->level > level; n = n->next) {
+ if (n->level == level+1)
+ n->enter_live_mode();
}
+ grp->end();
return live_widget;
}
Fl_Widget *Fl_Tabs_Type::enter_live_mode(int) {
Fl_Tabs *grp = new Fl_Tabs(o->x(), o->y(), o->w(), o->h());
live_widget = grp;
- if (live_widget) {
- copy_properties();
- Fl_Type *n;
- for (n = next; n && n->level > level; n = n->next) {
- if (n->level == level+1)
- n->enter_live_mode();
- }
- grp->end();
+ copy_properties();
+ Fl_Type *n;
+ for (n = next; n && n->level > level; n = n->next) {
+ if (n->level == level+1)
+ n->enter_live_mode();
}
+ grp->end();
grp->value(((Fl_Tabs*)o)->value());
return live_widget;
}
@@ -368,10 +364,8 @@ Fl_Widget *Fl_Tabs_Type::enter_live_mode(int) {
Fl_Widget *Fl_Table_Type::enter_live_mode(int) {
Fl_Group *grp = new Fluid_Table(o->x(), o->y(), o->w(), o->h());
live_widget = grp;
- if (live_widget) {
- copy_properties();
- grp->end();
- }
+ copy_properties();
+ grp->end();
return live_widget;
}
@@ -396,15 +390,13 @@ Fl_Widget *Fl_Scroll_Type::enter_live_mode(int) {
Fl_Group *grp = new Fl_Scroll(o->x(), o->y(), o->w(), o->h());
grp->show();
live_widget = grp;
- if (live_widget) {
- copy_properties();
- Fl_Type *n;
- for (n = next; n && n->level > level; n = n->next) {
- if (n->level == level+1)
- n->enter_live_mode();
- }
- grp->end();
+ copy_properties();
+ Fl_Type *n;
+ for (n = next; n && n->level > level; n = n->next) {
+ if (n->level == level+1)
+ n->enter_live_mode();
}
+ grp->end();
return live_widget;
}
diff --git a/fluid/Fl_Menu_Type.cxx b/fluid/Fl_Menu_Type.cxx
index 5e51a6ee2..e4c09be01 100644
--- a/fluid/Fl_Menu_Type.cxx
+++ b/fluid/Fl_Menu_Type.cxx
@@ -360,27 +360,27 @@ void Fl_Menu_Item_Type::write_code1() {
}
}
- int init = 0;
+ int menuItemInitialized = 0;
// if the name is an array variable, assign the value here
if (name() && strchr(name(), '[')) {
write_c("%s%s = &%s[%d];\n", indent(), name(), mname, i);
}
if (image) {
- if (!init) {
- init = 1;
- write_c("%s{ Fl_Menu_Item* o = &%s[%d];\n", indent(), mname, i);
- }
+ menuItemInitialized = 1;
+ write_c("%s{ Fl_Menu_Item* o = &%s[%d];\n", indent(), mname, i);
image->write_code("o");
}
- for (int n=0; n < NUM_EXTRA_CODE; n++)
+ for (int n=0; n < NUM_EXTRA_CODE; n++) {
if (extra_code(n) && !isdeclare(extra_code(n))) {
- if (!init) {
- init = 1;
- write_c("%s{ Fl_Menu_Item* o = &%s[%d];\n", indent(), mname, i);
+ if (!menuItemInitialized) {
+ menuItemInitialized = 1;
+ write_c("%s{ Fl_Menu_Item* o = &%s[%d];\n", indent(), mname, i);
}
write_c("%s %s\n", indent(), extra_code(n));
}
- if (init) write_c("%s}\n",indent());
+ }
+ if (menuItemInitialized)
+ write_c("%s}\n",indent());
}
void Fl_Menu_Item_Type::write_code2() {}
diff --git a/src/Fl.cxx b/src/Fl.cxx
index b29b7a260..417a0acca 100644
--- a/src/Fl.cxx
+++ b/src/Fl.cxx
@@ -1306,6 +1306,7 @@ int Fl::handle_(int e, Fl_Window* window)
case FL_UNFOCUS:
window = 0;
+ // FALLTHROUGH
case FL_FOCUS:
fl_xfocus = window;
fl_fix_focus();
diff --git a/src/Fl_Browser.cxx b/src/Fl_Browser.cxx
index 7621c6598..196796b97 100644
--- a/src/Fl_Browser.cxx
+++ b/src/Fl_Browser.cxx
@@ -511,7 +511,7 @@ void Fl_Browser::item_draw(void* item, int X, int Y, int W, int H) const {
char* str = l->txt;
const int* i = column_widths();
- bool first = true; // for icon
+ bool firstLoop = true; // for icon
while (W > 6) { // do each tab-separated field
int w1 = W; // width for this field
char* e = 0; // pointer to end of field or null if none
@@ -520,8 +520,8 @@ void Fl_Browser::item_draw(void* item, int X, int Y, int W, int H) const {
if (e) {*e = 0; w1 = *i++;}
}
// Icon drawing code
- if (first) {
- first = false;
+ if (firstLoop) {
+ firstLoop = false;
if (l->icon) {
l->icon->draw(X+2,Y+1); // leave 2px left, 1px above
int iconw = l->icon->w()+2;
diff --git a/src/Fl_File_Chooser2.cxx b/src/Fl_File_Chooser2.cxx
index 57226056d..426dbfd51 100644
--- a/src/Fl_File_Chooser2.cxx
+++ b/src/Fl_File_Chooser2.cxx
@@ -432,7 +432,8 @@ Fl_File_Chooser::count() {
void
Fl_File_Chooser::directory(const char *d)// I - Directory to change to
{
- char *dirptr; // Pointer into directory
+ char *dirptr; // Pointer into directory
+ char fixpath[FL_PATH_MAX]; // Path with slashes converted
// printf("Fl_File_Chooser::directory(\"%s\")\n", d == NULL ? "(null)" : d);
@@ -444,7 +445,6 @@ Fl_File_Chooser::directory(const char *d)// I - Directory to change to
if (Fl::system_driver()->backslash_as_slash()) {
// See if the filename contains backslashes...
char *slash; // Pointer to slashes
- char fixpath[FL_PATH_MAX]; // Path with slashes converted
if (strchr(d, '\\')) {
// Convert backslashes to slashes...
strlcpy(fixpath, d, sizeof(fixpath));
diff --git a/src/Fl_Input_.cxx b/src/Fl_Input_.cxx
index 1ffc3c402..ef6900d6e 100644
--- a/src/Fl_Input_.cxx
+++ b/src/Fl_Input_.cxx
@@ -1010,6 +1010,7 @@ int Fl_Input_::handletext(int event, int X, int Y, int W, int H) {
if (!(damage()&FL_DAMAGE_EXPOSE)) {minimal_update(position_); erase_cursor_only = 1;}
} else //if (Fl::selection_owner() != this)
minimal_update(mark_, position_);
+ // FALLTHROUGH
case FL_HIDE:
fl_reset_spot();
if (!readonly() && (when() & FL_WHEN_RELEASE))
diff --git a/src/Fl_Menu.cxx b/src/Fl_Menu.cxx
index b51b4e040..3ab303dea 100644
--- a/src/Fl_Menu.cxx
+++ b/src/Fl_Menu.cxx
@@ -533,7 +533,7 @@ int menuwindow::find_selected(int mx, int my) {
if (my < 0 || my >= h()) return -1;
if (!itemheight) { // menubar
int xx = 3; int n = 0;
- const Fl_Menu_Item* m = menu ? menu->first() : 0;
+ const Fl_Menu_Item* m = menu->first();
for (; ; m = m->next(), n++) {
if (!m->text) return -1;
xx += m->measure(0, button) + 16;
diff --git a/src/Fl_Text_Buffer.cxx b/src/Fl_Text_Buffer.cxx
index 6b46dd497..8df527b1b 100644
--- a/src/Fl_Text_Buffer.cxx
+++ b/src/Fl_Text_Buffer.cxx
@@ -1248,7 +1248,7 @@ void Fl_Text_Buffer::remove_(int start, int end)
/* expand the gap to encompass the deleted characters */
mGapEnd += end - mGapStart;
- mGapStart -= mGapStart - start;
+ mGapStart = start;
/* update the length */
mLength -= end - start;