Skip to content

Commit

Permalink
Revert "ofxGui: Updating events to allow multiwindow functioning (#6539
Browse files Browse the repository at this point in the history
…)" (#6544)

This reverts commit ce27971.
  • Loading branch information
arturoc authored Feb 14, 2020
1 parent ce27971 commit 065ed29
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 17 deletions.
13 changes: 1 addition & 12 deletions addons/ofxGui/src/ofxBaseGui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,19 +138,8 @@ void ofxBaseGui::unregisterMouseEvents(){
ofUnregisterMouseEvents(this, defaultEventsPriority);
bRegisteredForMouseEvents = false;
}
void ofxBaseGui::setEvents(ofCoreEvents & _events){
if(&_events != events){
bool wasMouseInputEnabled = bRegisteredForMouseEvents;// || !events;
unregisterMouseEvents();
events = &_events;
if (wasMouseInputEnabled) {
// note: this will set bMouseInputEnabled to true as a side-effect.
registerMouseEvents();
}
}
}

void ofxBaseGui::draw(){
setEvents(ofEvents());
if(needsRedraw){
generateDraw();
needsRedraw = false;
Expand Down
8 changes: 3 additions & 5 deletions addons/ofxGui/src/ofxBaseGui.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ class ofxBaseGui {
static void loadFont(const ofTrueTypeFontSettings & fontSettings);
static void setUseTTF(bool bUseTTF);

virtual void registerMouseEvents();
virtual void unregisterMouseEvents();
void registerMouseEvents();
void unregisterMouseEvents();

virtual void sizeChangedCB();
virtual void setParent(ofxBaseGui * parent);
Expand All @@ -89,7 +89,6 @@ class ofxBaseGui {
virtual void mouseExited(ofMouseEventArgs &){
}

void setEvents(ofCoreEvents & events);
protected:
virtual void render() = 0;
virtual bool setValue(float mx, float my, bool bCheckBounds) = 0;
Expand Down Expand Up @@ -136,11 +135,10 @@ class ofxBaseGui {
static void loadStencilFromHex(ofImage & img, unsigned char * data);

void setNeedsRedraw();
ofCoreEvents * events = nullptr;

private:
bool needsRedraw;
unsigned long currentFrame;
bool bRegisteredForMouseEvents;

//std::vector<ofEventListener> coreListeners;
};

0 comments on commit 065ed29

Please sign in to comment.