1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 12:28:22 +01:00

fixed scroller bug when displaying scroller before

setting initial values
This commit is contained in:
kojima
2001-02-25 20:47:04 +00:00
parent 054d7cc006
commit 64defd4d22
5 changed files with 34 additions and 6 deletions

View File

@@ -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;

View File

@@ -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);

View File

@@ -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 */
@@ -122,6 +124,9 @@ WMCreateScroller(WMWidget *parent)
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)
@@ -430,7 +437,6 @@ paintScroller(Scroller *sPtr)
knobP = sPtr->floatValue * ((float)length - knobL); knobP = sPtr->floatValue * ((float)length - knobL);
if (sPtr->flags.horizontal) { if (sPtr->flags.horizontal) {
/* before */ /* before */
XFillRectangle(scr->display, d, scr->stippleGC, XFillRectangle(scr->display, d, scr->stippleGC,
@@ -713,6 +719,7 @@ floatValueForPoint(int slotOfs, int slotLength, int knobLength, int point)
floatValue = (position-(float)slotOfs) / (float)(slotLength-knobLength); floatValue = (position-(float)slotOfs) / (float)(slotLength-knobLength);
#endif #endif
assert(!isnan(floatValue));
return floatValue; return floatValue;
} }

View File

@@ -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);