void win_setregion(WinRegion id);\r
\r
void onupdate(void);\r
-void mouse_left(WinRegion id, size_t count, size_t row, size_t col);\r
-void mouse_middle(WinRegion id, size_t count, size_t row, size_t col);\r
-void mouse_right(WinRegion id, size_t count, size_t row, size_t col);\r
-\r
-\r
+void onmouseleft(WinRegion id, size_t count, size_t row, size_t col);\r
+void onmousemiddle(WinRegion id, size_t count, size_t row, size_t col);\r
+void onmouseright(WinRegion id, size_t count, size_t row, size_t col);\r
\r
static void onshutdown(void);
static void mouse_wheelup(WinRegion id, size_t count, size_t row, size_t col);
static void mouse_wheeldn(WinRegion id, size_t count, size_t row, size_t col);
+static void mouse_left(WinRegion id, size_t count, size_t row, size_t col);
+static void mouse_middle(WinRegion id, size_t count, size_t row, size_t col);
+static void mouse_right(WinRegion id, size_t count, size_t row, size_t col);
static XFont Font;
static XConfig Config = {
view_scroll(win_view(id), +ScrollLines);
}
+static void mouse_left(WinRegion id, size_t count, size_t row, size_t col) {
+ if (id == SCROLL)
+ view_scroll(win_view(EDIT), row);
+ else
+ onmouseleft(id,count,row,col);
+}
+
+static void mouse_middle(WinRegion id, size_t count, size_t row, size_t col) {
+ if (id == SCROLL)
+ printf("scroll row: %lu\n", row);
+ else
+ onmousemiddle(id,count,row,col);
+}
+
+static void mouse_right(WinRegion id, size_t count, size_t row, size_t col) {
+ if (id == SCROLL)
+ view_scroll(win_view(EDIT), row - (win_view(EDIT)->nrows-1));
+ else
+ onmouseright(id,count,row,col);
+}
+
/*****************************************************************************/
static void draw_glyphs(size_t x, size_t y, UGlyph* glyphs, size_t rlen, size_t ncols) {
/* Mouse Handling
*****************************************************************************/
-void mouse_left(WinRegion id, size_t count, size_t row, size_t col) {
+void onmouseleft(WinRegion id, size_t count, size_t row, size_t col) {
}
-void mouse_middle(WinRegion id, size_t count, size_t row, size_t col) {
+void onmousemiddle(WinRegion id, size_t count, size_t row, size_t col) {
}
-void mouse_right(WinRegion id, size_t count, size_t row, size_t col) {
+void onmouseright(WinRegion id, size_t count, size_t row, size_t col) {
}
-MouseConfig* MouseHandlers[NREGIONS] = {
- [EDIT] = &(MouseConfig){
- .left = mouse_left,
- .middle = mouse_middle,
- .right = mouse_right
- }
-};
+//MouseConfig* MouseHandlers[NREGIONS] = {
+// [EDIT] = &(MouseConfig){
+// .left = mouse_left,
+// .middle = mouse_middle,
+// .right = mouse_right
+// }
+//};
/* Keyboard Handling
*****************************************************************************/
/* Mouse Handling
*****************************************************************************/
-void mouse_left(WinRegion id, size_t count, size_t row, size_t col) {
+void onmouseleft(WinRegion id, size_t count, size_t row, size_t col) {
if (count == 1) {
if (x11_keymodsset(ModShift))
view_selext(win_view(id), row, col);
}
}
-void mouse_middle(WinRegion id, size_t count, size_t row, size_t col) {
+void onmousemiddle(WinRegion id, size_t count, size_t row, size_t col) {
if (win_btnpressed(MOUSE_BTN_LEFT)) {
cut();
} else {
}
}
-void mouse_right(WinRegion id, size_t count, size_t row, size_t col) {
+void onmouseright(WinRegion id, size_t count, size_t row, size_t col) {
if (win_btnpressed(MOUSE_BTN_LEFT)) {
paste();
} else {