mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-11-22 22:41:30 +03:00
Add scrollwheel support to textareas.
This commit is contained in:
parent
f57e89cc25
commit
698f391289
@ -2078,3 +2078,19 @@ void textarea_set_layout(struct textarea *ta, int width, int height,
|
||||
ta->pad_left = left;
|
||||
textarea_reflow(ta, 0);
|
||||
}
|
||||
|
||||
|
||||
/* exported interface, documented in textarea.h */
|
||||
bool textarea_scroll(struct textarea *ta, int scrx, int scry)
|
||||
{
|
||||
bool handled_scroll = false;
|
||||
|
||||
if (ta->bar_x != NULL && scrx != 0 &&
|
||||
scrollbar_scroll(ta->bar_x, scrx))
|
||||
handled_scroll = true;
|
||||
if (ta->bar_y != NULL && scry != 0 &&
|
||||
scrollbar_scroll(ta->bar_y, scry))
|
||||
handled_scroll = true;
|
||||
|
||||
return handled_scroll;
|
||||
}
|
||||
|
@ -219,5 +219,16 @@ void textarea_set_dimensions(struct textarea *ta, int width, int height);
|
||||
*/
|
||||
void textarea_set_layout(struct textarea *ta, int width, int height,
|
||||
int top, int right, int bottom, int left);
|
||||
|
||||
/**
|
||||
* Scroll a textarea by an amount. Only does anything if multi-line textarea
|
||||
* has scrollbars. If it scrolls, it will emit a redraw request.
|
||||
*
|
||||
* \param ta textarea widget
|
||||
* \param scrx number of px try to scroll in x direction
|
||||
* \param scry number of px try to scroll in y direction
|
||||
* \return true iff the textarea was scrolled
|
||||
*/
|
||||
bool textarea_scroll(struct textarea *ta, int scrx, int scry);
|
||||
#endif
|
||||
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "desktop/options.h"
|
||||
#include "desktop/selection.h"
|
||||
#include "desktop/scrollbar.h"
|
||||
#include "desktop/textarea.h"
|
||||
#include "image/bitmap.h"
|
||||
#include "render/box.h"
|
||||
#include "render/font.h"
|
||||
@ -2681,6 +2682,14 @@ html_scroll_at_point(struct content *c, int x, int y, int scrx, int scry)
|
||||
x - box_x, y - box_y, scrx, scry) == true)
|
||||
return true;
|
||||
|
||||
/* Pass into textarea widget */
|
||||
if (box->gadget && (box->gadget->type == GADGET_TEXTAREA ||
|
||||
box->gadget->type == GADGET_PASSWORD ||
|
||||
box->gadget->type == GADGET_TEXTBOX) &&
|
||||
textarea_scroll(box->gadget->data.text.ta,
|
||||
scrx, scry) == true)
|
||||
return true;
|
||||
|
||||
/* Pass into object */
|
||||
if (box->object != NULL && content_scroll_at_point(
|
||||
box->object, x - box_x, y - box_y,
|
||||
|
Loading…
Reference in New Issue
Block a user