Commit 1c28a0e598b27deb73ffa6e622388682a7d4d88b

Authored by perry.werneck@gmail.com
1 parent 28296b0c

Acertando ponteiro do mouse em windows, corrigindo "drag" da area selecionada

Showing 2 changed files with 31 additions and 16 deletions   Show diff stats
src/gtk/v3270/widget.c
@@ -269,7 +269,7 @@ static void v3270_class_init(v3270Class *klass) @@ -269,7 +269,7 @@ static void v3270_class_init(v3270Class *klass)
269 "arrow", 269 "arrow",
270 "wait", 270 "wait",
271 "arrow", 271 "arrow",
272 - "sizeall", 272 + "hand",
273 "sizenwse", // Top-left 273 "sizenwse", // Top-left
274 "sizenesw", // Top-right 274 "sizenesw", // Top-right
275 "sizens", // Top 275 "sizens", // Top
@@ -278,14 +278,14 @@ static void v3270_class_init(v3270Class *klass) @@ -278,14 +278,14 @@ static void v3270_class_init(v3270Class *klass)
278 "sizens", // Bottom 278 "sizens", // Bottom
279 "sizewe", // Left 279 "sizewe", // Left
280 "sizewe", // Right 280 "sizewe", // Right
281 - } 281 + };
282 #else 282 #else
283 static const int cr[V3270_CURSOR_COUNT] = 283 static const int cr[V3270_CURSOR_COUNT] =
284 { 284 {
285 GDK_XTERM, 285 GDK_XTERM,
286 GDK_WATCH, 286 GDK_WATCH,
287 GDK_X_CURSOR, 287 GDK_X_CURSOR,
288 - GDK_FLEUR, 288 + GDK_HAND1,
289 GDK_TOP_LEFT_CORNER, // Top-left 289 GDK_TOP_LEFT_CORNER, // Top-left
290 GDK_TOP_RIGHT_CORNER, // Top-right 290 GDK_TOP_RIGHT_CORNER, // Top-right
291 GDK_TOP_SIDE, // Top 291 GDK_TOP_SIDE, // Top
src/lib3270/selection.c
@@ -437,27 +437,42 @@ LIB3270_EXPORT int lib3270_get_selected_addr(H3270 *hSession, int *begin, int *e @@ -437,27 +437,42 @@ LIB3270_EXPORT int lib3270_get_selected_addr(H3270 *hSession, int *begin, int *e
437 437
438 LIB3270_EXPORT int lib3270_move_selected_area(H3270 *hSession, int from, int to) 438 LIB3270_EXPORT int lib3270_move_selected_area(H3270 *hSession, int from, int to)
439 { 439 {
440 - int step = (to - from);  
441 - int first, last, pos, len; 440 + int pos[2];
  441 + int rows, cols, f, step;
442 442
443 - if(lib3270_get_selected_addr(hSession,&first,&last)) 443 + if(lib3270_get_selected_addr(hSession,&pos[0],&pos[1]))
444 return from; 444 return from;
445 445
446 - len = hSession->rows * hSession->cols; 446 + rows = (to / hSession->cols) - (from / hSession->cols);
  447 + cols = (to % hSession->cols) - (from % hSession->cols);
447 448
448 - pos = first+step;  
449 - trace("first=%d pos=%d step=%d",first,pos,step);  
450 - if(pos < 0)  
451 - step -= pos; 449 + for(f=0;f<2;f++)
  450 + {
  451 + int row = (pos[f] / hSession->cols) + rows;
  452 + int col = (pos[f] % hSession->cols) + cols;
  453 +
  454 + if(row < 0)
  455 + rows = - (pos[f] / hSession->cols);
  456 +
  457 + if(col < 0)
  458 + cols = - (pos[f] % hSession->cols);
  459 +
  460 + if(row >= (hSession->rows))
  461 + rows = hSession->rows - ((pos[f] / hSession->cols)+1);
452 462
453 - pos = last+step;  
454 - if(pos > len)  
455 - step -= (pos - len); 463 + if(col >= hSession->cols)
  464 + cols = hSession->cols - ((pos[f] % hSession->cols)+1);
  465 + }
  466 +
  467 + step = (rows * hSession->cols) + cols;
456 468
  469 + hSession->select.begin += step;
  470 + hSession->select.end += step;
457 471
458 - trace("%s step=%d",__FUNCTION__,step); 472 + update_selection(hSession);
  473 + lib3270_set_cursor_address(hSession,hSession->select.end);
459 474
460 - return from; 475 + return from+step;
461 } 476 }
462 477
463 LIB3270_EXPORT int lib3270_move_selection(H3270 *hSession, LIB3270_DIRECTION dir) 478 LIB3270_EXPORT int lib3270_move_selection(H3270 *hSession, LIB3270_DIRECTION dir)