Am Sonntag, 30. Juli 2006 08:46 schrieb Abdelrazak Younes:
> Georg Baum wrote:
> >> | There is general breakage in trunk, probably related to the update
> >> | changes of Abdel and Lars. It is e.g. not possible to bring up an 
inset
> >> | dialog by clicking with the mouse on the inset.
> >>
> >> This is bad.
> > 
> > Indeed. Unfortunately I am not sure when exactly this problem occured. 
I
> > don't have the time to look after it now, but I guess that Abdel could
> > quickly tell whether it has something to do with his work or not when 
he is
> > back.
> 
> Hello,
> 
> I don't have the source at hand but I guess the behavior you are 
> describing is a missing second call to updateMetrics(). I am pretty sure 
> qt4 works and that it is a qt3 problem.

You are right.

> I guess I forgot to update the  
> update mechanism for qt3. You need to either call WorkArea::redraw() at 
> the end of each event in QWorkArea or call directly the associated event 
> in WorkArea. Please see qt4/GuiWorkArea as an example. If you don't fix 
> it, I'll do it when I come back the 12th.

I managed to fix the redraw calls with the attached patch. Now clicking on 
collapsed insets works again, and the missing redraws I observed are gone. 
The scrollbar does still not work: trying to drag it with the mouse, or 
clicking below or above the slider does not move it, it results only in 
some flickering (both qt3 and qt4).

Please have a look at that when you are back.

This patch goes in soon unless I get objections.


Georg

Log:
Fix redraw problems in qt3 and gtk
        * src/frontends/gtk/GWorkArea.C
        (GWorkArea::onScroll): redraw the workarea
        (GWorkArea::onButtonPress): Call WorkArea::dispatch instead of
        BufferView::workAreaDispatch in order to redraw the workarea
        (GWorkArea::onButtonRelease): ditto
        (GWorkArea::onMotionNotify): ditto

        * src/frontends/WorkArea.h
        (dispatch): make public

        * src/frontends/qt3/QContentPane.C
        (QContentPane::scrollBarChanged): redraw the workarea
        (QContentPane::generateSyntheticMous): Call WorkArea::dispatch instead
        of BufferView::workAreaDispatch in order to redraw the workarea
        (QContentPane::mousePressEvent): ditto
        (QContentPane::mouseReleaseEvent): ditto
        (QContentPane::mouseMoveEvent): ditto
        (QContentPane::doubleClickTimeout): ditto
Index: src/frontends/gtk/GWorkArea.C
===================================================================
--- src/frontends/gtk/GWorkArea.C	(Revision 14512)
+++ src/frontends/gtk/GWorkArea.C	(Arbeitskopie)
@@ -377,6 +377,7 @@ void GWorkArea::onScroll()
 
 	double val = vscrollbar_.get_adjustment()->get_value();
 	view_.view()->scrollDocView(static_cast<int>(val));
+	view_.workArea()->redraw();
 	adjusting_ = false;
 }
 
@@ -422,7 +423,7 @@ bool GWorkArea::onButtonPress(GdkEventBu
 	default:
 		break;
 	}
-	view_.view()->workAreaDispatch(FuncRequest(ka,
+	view_.workArea()->dispatch(FuncRequest(ka,
 			     static_cast<int>(event->x),
 			     static_cast<int>(event->y),
 			     gButtonToLyx(event->button)));
@@ -433,7 +434,7 @@ bool GWorkArea::onButtonPress(GdkEventBu
 
 bool GWorkArea::onButtonRelease(GdkEventButton * event)
 {
-	view_.view()->workAreaDispatch(FuncRequest(LFUN_MOUSE_RELEASE,
+	view_.workArea()->dispatch(FuncRequest(LFUN_MOUSE_RELEASE,
 			     static_cast<int>(event->x),
 			     static_cast<int>(event->y),
 			     gButtonToLyx(event->button)));
@@ -458,7 +459,7 @@ bool GWorkArea::onMotionNotify(GdkEventM
 		}
 		timeBefore = event->time;
 	}
-	view_.view()->workAreaDispatch(FuncRequest(LFUN_MOUSE_MOTION,
+	view_.workArea()->dispatch(FuncRequest(LFUN_MOUSE_MOTION,
 			     static_cast<int>(event->x),
 			     static_cast<int>(event->y),
 			     gtkButtonState(event->state)));
Index: src/frontends/WorkArea.h
===================================================================
--- src/frontends/WorkArea.h	(Revision 14512)
+++ src/frontends/WorkArea.h	(Arbeitskopie)
@@ -105,9 +105,11 @@ protected:
 	/// cause the display of the given area of the work area
 	virtual void expose(int x, int y, int w, int h) = 0;
 
-	///
+public:
+	/// FIXME: This is public because of qt3 and gtk, should be protected
 	void dispatch(FuncRequest const & cmd0);
 
+protected:
 	///
 	void resizeBufferView();
 
Index: src/frontends/qt3/QContentPane.C
===================================================================
--- src/frontends/qt3/QContentPane.C	(Revision 14512)
+++ src/frontends/qt3/QContentPane.C	(Arbeitskopie)
@@ -162,15 +162,17 @@ void QContentPane::generateSyntheticMous
 		synthetic_mouse_event_.scrollbar_value_old = scrollbar_value;
 
 		// ... and dispatch the event to the LyX core.
-		wa_->view().view()->workAreaDispatch(synthetic_mouse_event_.cmd);
+		wa_->view().workArea()->dispatch(synthetic_mouse_event_.cmd);
 	}
 }
 
 
 void QContentPane::scrollBarChanged(int val)
 {
-	if (track_scrollbar_)
+	if (track_scrollbar_) {
 		wa_->view().view()->scrollDocView(val);
+		wa_->view().workArea()->redraw();
+	}
 }
 
 
@@ -181,13 +183,13 @@ void QContentPane::mousePressEvent(QMous
 		FuncRequest cmd(LFUN_MOUSE_TRIPLE,
 			dc_event_.x, dc_event_.y,
 			q_button_state(dc_event_.state));
-		wa_->view().view()->workAreaDispatch(cmd);
+		wa_->view().workArea()->dispatch(cmd);
 		return;
 	}
 
 	FuncRequest const cmd(LFUN_MOUSE_PRESS, e->x(), e->y(),
 			      q_button_state(e->button()));
-	wa_->view().view()->workAreaDispatch(cmd);
+	wa_->view().workArea()->dispatch(cmd);
 }
 
 
@@ -198,7 +200,7 @@ void QContentPane::mouseReleaseEvent(QMo
 
 	FuncRequest const cmd(LFUN_MOUSE_RELEASE, e->x(), e->y(),
 			      q_button_state(e->button()));
-	wa_->view().view()->workAreaDispatch(cmd);
+	wa_->view().workArea()->dispatch(cmd);
 }
 
 
@@ -258,7 +260,7 @@ void QContentPane::mouseMoveEvent(QMouse
 		synthetic_mouse_event_.scrollbar_value_old = scrollbar_value;
 
 		// ... and dispatch the event to the LyX core.
-		wa_->view().view()->workAreaDispatch(cmd);
+		wa_->view().workArea()->dispatch(cmd);
 	}
 }
 
@@ -317,7 +319,7 @@ void QContentPane::doubleClickTimeout()
 	FuncRequest cmd(LFUN_MOUSE_DOUBLE,
 		dc_event_.x, dc_event_.y,
 		q_button_state(dc_event_.state));
-	wa_->view().view()->workAreaDispatch(cmd);
+	wa_->view().workArea()->dispatch(cmd);
 }
 
 

Reply via email to