Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fl_Input_::position shadowing Fl_Widget::position #69

Closed
pwiecz opened this issue Apr 1, 2020 · 8 comments
Closed

Fl_Input_::position shadowing Fl_Widget::position #69

pwiecz opened this issue Apr 1, 2020 · 8 comments
Assignees
Labels
enhancement New feature or request waiting for confirmation waiting for someone's confirmation

Comments

@pwiecz
Copy link

pwiecz commented Apr 1, 2020

In FLTK version 1.3 Fl_Input_::position method is shadowing Fl_Widget::position virtual method.
Maybe it's time to fix it in 1.4?

@Albrecht-S Albrecht-S added the enhancement New feature or request label Apr 1, 2020
@Albrecht-S
Copy link
Member

Thanks for the heads-up.

This is true, however it would need an API change which we try to avoid as much as possible.

One possible solution: deprecate Fl_Input_::position() and add a new method, for instance Fl_Input::insert_position() to replace it (all three overloaded methods). Then we could remove Fl_Input_::position() in a later FLTK version, presumably 1.5 (or higher).

@pwiecz
Copy link
Author

pwiecz commented Apr 1, 2020

Oh, I thought that 1.4 is not considered stable, so API changes are still possible.
But I understand, that API is already stabilised.

@Albrecht-S
Copy link
Member

Thanks for your feedback. To explain: we try to keep the API (Application Programming Interface) across all versions so developers don't need to change their program code from one FLTK version to another. You could still compile most of FLTK 1.1 code with 1.3 (with a few minor exceptions) and so you will with 1.4.

The ABI (Application Binary Interface) however is not yet final for 1.4, it can still be modified until 1.4.0 gets released, but must be constant during 1.4.x releases.

@Albrecht-S
Copy link
Member

FTR: I noticed that Fl_Text_Display and Fl_Text_Editor (by inheritance) already have an insert_position() method. This needs to be checked and can be either

  1. good, if arguments and semantics are the same (compatible)
  2. bad, if not. Then we'd need another name.

This is just a reminder - code not yet checked.

@Albrecht-S
Copy link
Member

Note: we have more than only the methods mentioned above shadowing Fl_Widget::position(). This is what I found (may not be complete):

int Fl_Browser_::position() const { return position_; }
void Fl_Browser_::position(int pos);

void Fl_Help_Dialog::position(int xx, int yy);

int Fl_Input_::position() const {return position_;}
int Fl_Input_::position(int p, int m);
int Fl_Input_::position(int p) {return position(p, p);}

int Fl_Text_Selection::position(int *startpos, int *endpos) const;

void Fl_Tile::position(int oldx, int oldy, int newx, int newy);

void Fl_Widget::position(int X, int Y) {resize(X, Y, w_, h_);}

I wonder if it's worth the effort to change any of these methods, particularly since we need to keep the API for backwards compatibility anyway, at least for some (indefinite) time and you can always use Fl_Widget::position(X, Y) explicitly.

Just thinking aloud: maybe we could add another method like Fl_Widget::set_position(int X, int Y) so users can use this instead (w/o a name conflict).

@MatthiasWM
Copy link
Contributor

MatthiasWM commented Jan 31, 2023

PR is in #666

  • Fl_Browser_::position -> Fl_Browser_::vposition (mirrors Fl_Browser_::hposition)
  • Fl_Input_::position -> Fl_Input_::insert_position (mirrors Fl_Text_Input)
  • Fl_Text_Selection::position -> Fl_Text_Selection:: selected()
  • Fl_Help_Dialog::position is ok, as it repositions the window
  • Fl_Tile::position -> Fl_Tile:: move_intersection (was: adjust)
  • update all includes tests

@Albrecht-S
Copy link
Member

Fl_Tile::position -> Fl_Tile::adjust

Just for the record: isn't this Fl_Tile::move_intersection() in #666 ?

@MatthiasWM
Copy link
Contributor

Yep, I changed my mind when implementing it. Fixed.

@MatthiasWM MatthiasWM added the waiting for confirmation waiting for someone's confirmation label Jan 31, 2023
MatthiasWM added a commit that referenced this issue Feb 2, 2023
* `FL_DEPRECATED` macro to mark `position()` method that shadow `Fl_Widget::position()` #69 (#666)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request waiting for confirmation waiting for someone's confirmation
Projects
None yet
Development

No branches or pull requests

3 participants