mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 04:20:27 +01:00
fixed scroller bug when displaying scroller before
setting initial values
This commit is contained in:
@@ -876,7 +876,7 @@ static void handleTableEvents(XEvent *event, void *data)
|
|||||||
case MotionNotify:
|
case MotionNotify:
|
||||||
if (table->dragging && event->xmotion.y >= 0) {
|
if (table->dragging && event->xmotion.y >= 0) {
|
||||||
row = event->xmotion.y/table->rowHeight;
|
row = event->xmotion.y/table->rowHeight;
|
||||||
if (table->clickedRow != row && row >= 0) {
|
if (table->clickedRow != row && row >= 0 && row < table->rows) {
|
||||||
setRowSelected(table, table->clickedRow, False);
|
setRowSelected(table, table->clickedRow, False);
|
||||||
setRowSelected(table, row, True);
|
setRowSelected(table, row, True);
|
||||||
table->clickedRow = row;
|
table->clickedRow = row;
|
||||||
|
|||||||
@@ -483,6 +483,25 @@ WMCreateInputPanel(WMScreen *scrPtr, WMWindow *owner, char *title, char *msg,
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
handleKeyPress3(XEvent *event, void *clientData)
|
||||||
|
{
|
||||||
|
WMGenericPanel *panel = (WMAlertPanel*)clientData;
|
||||||
|
KeySym ksym;
|
||||||
|
|
||||||
|
XLookupString(&event->xkey, NULL, 0, &ksym, NULL);
|
||||||
|
|
||||||
|
if (ksym == XK_Return && panel->defBtn) {
|
||||||
|
WMPerformButtonClick(panel->defBtn);
|
||||||
|
} else if (ksym == XK_Escape) {
|
||||||
|
if (panel->altBtn) {
|
||||||
|
WMPerformButtonClick(panel->altBtn);
|
||||||
|
} else {
|
||||||
|
panel->result = WAPRDefault;
|
||||||
|
WMBreakModalLoop(WMWidgetScreen(panel->win));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -618,8 +637,8 @@ WMCreateGenericPanel(WMScreen *scrPtr, WMWindow *owner,
|
|||||||
|
|
||||||
WMMapSubwidgets(hbox);
|
WMMapSubwidgets(hbox);
|
||||||
|
|
||||||
// WMCreateEventHandler(W_VIEW(panel->win), KeyPressMask,
|
WMCreateEventHandler(W_VIEW(panel->win), KeyPressMask,
|
||||||
// handleKeyPress3, panel);
|
handleKeyPress3, panel);
|
||||||
|
|
||||||
WMRealizeWidget(panel->win);
|
WMRealizeWidget(panel->win);
|
||||||
WMMapSubwidgets(panel->win);
|
WMMapSubwidgets(panel->win);
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
#include "WINGsP.h"
|
#include "WINGsP.h"
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
/* undefine will disable the autoadjusting of the knob dimple to be
|
/* undefine will disable the autoadjusting of the knob dimple to be
|
||||||
* directly below the cursor
|
* directly below the cursor
|
||||||
* DOES NOT WORK */
|
* DOES NOT WORK */
|
||||||
@@ -121,6 +123,9 @@ WMCreateScroller(WMWidget *parent)
|
|||||||
handleActionEvents, sPtr);
|
handleActionEvents, sPtr);
|
||||||
|
|
||||||
sPtr->flags.hitPart = WSNoPart;
|
sPtr->flags.hitPart = WSNoPart;
|
||||||
|
|
||||||
|
sPtr->floatValue = 0.0;
|
||||||
|
sPtr->knobProportion = 1.0;
|
||||||
|
|
||||||
return sPtr;
|
return sPtr;
|
||||||
}
|
}
|
||||||
@@ -170,6 +175,8 @@ WMSetScrollerParameters(WMScroller *sPtr, float floatValue,
|
|||||||
{
|
{
|
||||||
CHECK_CLASS(sPtr, WC_Scroller);
|
CHECK_CLASS(sPtr, WC_Scroller);
|
||||||
|
|
||||||
|
assert(!isnan(floatValue));
|
||||||
|
|
||||||
if (floatValue < 0.0)
|
if (floatValue < 0.0)
|
||||||
sPtr->floatValue = 0.0;
|
sPtr->floatValue = 0.0;
|
||||||
else if (floatValue > 1.0)
|
else if (floatValue > 1.0)
|
||||||
@@ -429,7 +436,6 @@ paintScroller(Scroller *sPtr)
|
|||||||
knobL = (float)knobLength(sPtr);
|
knobL = (float)knobLength(sPtr);
|
||||||
|
|
||||||
knobP = sPtr->floatValue * ((float)length - knobL);
|
knobP = sPtr->floatValue * ((float)length - knobL);
|
||||||
|
|
||||||
|
|
||||||
if (sPtr->flags.horizontal) {
|
if (sPtr->flags.horizontal) {
|
||||||
/* before */
|
/* before */
|
||||||
@@ -712,7 +718,8 @@ floatValueForPoint(int slotOfs, int slotLength, int knobLength, int point)
|
|||||||
/* Compute the float value */
|
/* Compute the float value */
|
||||||
floatValue = (position-(float)slotOfs) / (float)(slotLength-knobLength);
|
floatValue = (position-(float)slotOfs) / (float)(slotLength-knobLength);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
assert(!isnan(floatValue));
|
||||||
return floatValue;
|
return floatValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -566,7 +566,7 @@ updateScrollerProportion(ScrollView *sPtr)
|
|||||||
oldP = WMGetScrollerKnobProportion(sPtr->hScroller);
|
oldP = WMGetScrollerKnobProportion(sPtr->hScroller);
|
||||||
|
|
||||||
prop = (float)sPtr->viewport->size.width/(float)sPtr->contentView->size.width;
|
prop = (float)sPtr->viewport->size.width/(float)sPtr->contentView->size.width;
|
||||||
|
|
||||||
if (oldP == 1.0)
|
if (oldP == 1.0)
|
||||||
value = 0;
|
value = 0;
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -448,6 +448,8 @@ destroyView(W_View *view)
|
|||||||
|
|
||||||
WMUnregisterViewDraggedTypes(view);
|
WMUnregisterViewDraggedTypes(view);
|
||||||
|
|
||||||
|
WMRemoveNotificationObserver(view);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (view->dragSourceProcs)
|
if (view->dragSourceProcs)
|
||||||
wfree(view->dragSourceProcs);
|
wfree(view->dragSourceProcs);
|
||||||
|
|||||||
Reference in New Issue
Block a user