gapplication.cpp (gambas-3.16.2.tar.bz2) | : | gapplication.cpp (gambas-3.16.3.tar.bz2) | ||
---|---|---|---|---|
skipping to change at line 558 | skipping to change at line 558 | |||
win->close(); | win->close(); | |||
} | } | |||
//fprintf(stderr, "handle event %s\n", type == gE vent_MousePress ? "press" : type == gEvent_MouseRelease ? "release" : "other"); | //fprintf(stderr, "handle event %s\n", type == gE vent_MousePress ? "press" : type == gEvent_MouseRelease ? "release" : "other"); | |||
goto __HANDLE_EVENT; | goto __HANDLE_EVENT; | |||
} | } | |||
control = save_control; | control = save_control; | |||
bool menu = false; | #if GTK_CHECK_VERSION(3, 4, 0) | |||
bool menu = gdk_event_triggers_context_menu(event); | ||||
#else | ||||
bool menu = (event->button.button == 3) && (event->type = | ||||
= GDK_BUTTON_PRESS); | ||||
#endif | ||||
if (event->type != GDK_BUTTON_RELEASE) | if (event->type != GDK_BUTTON_RELEASE) | |||
{ | { | |||
#if DEBUG_FOCUS | #if DEBUG_FOCUS | |||
fprintf(stderr, "GDK_BUTTON_PRESS: %s canFocus = %d design = %d\n", control->name(), control->canFocus(), control->isDesign()); | fprintf(stderr, "GDK_BUTTON_PRESS: %s canFocus = %d design = %d\n", control->name(), control->canFocus(), control->isDesign()); | |||
#endif | #endif | |||
if (control->canFocusOnClick()) | if (control->canFocusOnClick()) | |||
control->setFocus(); | control->setFocus(); | |||
if (!control->_no_auto_grab) | if (!control->_no_auto_grab) | |||
gApplication::setButtonGrab(control); | gApplication::setButtonGrab(control); | |||
} | } | |||
if (event->type == GDK_BUTTON_PRESS) | if (event->type == GDK_BUTTON_PRESS) | |||
gMouse::handleClickCount(event); | gMouse::handleClickCount(event); | |||
__BUTTON_TRY_PROXY: | __BUTTON_TRY_PROXY: | |||
if (!control->isDesign() && !control->isEnabled()) | ||||
goto __HANDLE_EVENT; | ||||
cancel = false; | cancel = false; | |||
if (control->onMouseEvent) | if (control->isDesign() || control->isEnabled()) | |||
{ | { | |||
if (event->type == GDK_BUTTON_PRESS || control->c anRaise(control, type)) | if (control->onMouseEvent) | |||
{ | { | |||
control->getScreenPos(&xc, &yc); | if (event->type == GDK_BUTTON_PRESS || co | |||
xs = (int)event->button.x_root; | ntrol->canRaise(control, type)) | |||
ys = (int)event->button.y_root; | ||||
x = xs - xc; | ||||
y = ys - yc; | ||||
gMouse::validate(); | ||||
gMouse::setEvent(event); | ||||
//gMouse::setValid(1,(int)event->x,(int)e | ||||
vent->y,event->button,event->state,data->screenX(),data->screenY()); | ||||
gMouse::setMouse(x, y, xs, ys, event->but | ||||
ton.button, event->button.state); | ||||
switch ((int)event->type) | ||||
{ | { | |||
case GDK_BUTTON_PRESS: | control->getScreenPos(&xc, &yc); | |||
gMouse::setControl(contro | xs = (int)event->button.x_root; | |||
l); | ys = (int)event->button.y_root; | |||
gMouse::setStart(x, y); | x = xs - xc; | |||
cancel = control->onMouse | y = ys - yc; | |||
Event(control, gEvent_MousePress); | ||||
break; | gMouse::validate(); | |||
gMouse::setEvent(event); | ||||
case GDK_2BUTTON_PRESS: | //gMouse::setValid(1,(int)event-> | |||
cancel = control->onMouse | x,(int)event->y,event->button,event->state,data->screenX(),data->screenY()); | |||
Event(control, gEvent_MouseDblClick); | gMouse::setMouse(x, y, xs, ys, ev | |||
break; | ent->button.button, event->button.state); | |||
switch ((int)event->type) | ||||
case GDK_BUTTON_RELEASE: | { | |||
gMouse::setControl(NULL); | case GDK_BUTTON_PRESS: | |||
cancel = control->onMouse | gMouse::setContro | |||
Event(control, gEvent_MouseRelease); | l(control); | |||
break; | gMouse::setStart( | |||
} | x, y); | |||
cancel = control- | ||||
>onMouseEvent(control, gEvent_MousePress); | ||||
break; | ||||
case GDK_2BUTTON_PRESS: | ||||
cancel = control- | ||||
>onMouseEvent(control, gEvent_MouseDblClick); | ||||
break; | ||||
case GDK_BUTTON_RELEASE: | ||||
gMouse::setContro | ||||
l(NULL); | ||||
cancel = control- | ||||
>onMouseEvent(control, gEvent_MouseRelease); | ||||
break; | ||||
} | ||||
gMouse::invalidate(); | gMouse::invalidate(); | |||
} | ||||
} | } | |||
} | } | |||
/*if (type == gEvent_MousePress && control->isTopLevel()) | if (type == gEvent_MouseRelease && control->_grab) | |||
{ | ||||
gMainWindow *win = ((gMainWindow *)control); | ||||
if (win->isPopup()) | ||||
{ | ||||
control->getScreenPos(&xc, &yc); | ||||
xs = (int)event->button.x_root; | ||||
ys = (int)event->button.y_root; | ||||
x = xs - xc; | ||||
y = ys - yc; | ||||
if (x < 0 || y < 0 || x >= win->width() | | ||||
| y >= win->height()) | ||||
win->close(); | ||||
} | ||||
} | ||||
else*/ if (type == gEvent_MouseRelease && control->_grab) | ||||
{ | { | |||
gApplication::exitLoop(control); | gApplication::exitLoop(control); | |||
} | } | |||
#if GTK_CHECK_VERSION(3, 4, 0) | ||||
if (gdk_event_triggers_context_menu(event)) | ||||
#else | ||||
if (event->button.button == 3 && event->type == GDK_BUTTO | ||||
N_PRESS) | ||||
#endif | ||||
menu = true; | ||||
if (!cancel) | if (!cancel) | |||
{ | { | |||
if (control->_proxy_for) | if (control->_proxy_for) | |||
{ | { | |||
control = control->_proxy_for; | control = control->_proxy_for; | |||
//fprintf(stderr, "PRESS: try %s\n", cont rol->name()); | //fprintf(stderr, "PRESS: try %s\n", cont rol->name()); | |||
goto __BUTTON_TRY_PROXY; | goto __BUTTON_TRY_PROXY; | |||
} | } | |||
} | } | |||
skipping to change at line 1023 | skipping to change at line 1005 | |||
gApplication::onThemeChange(); | gApplication::onThemeChange(); | |||
gDesktop::onThemeChange(); | gDesktop::onThemeChange(); | |||
} | } | |||
void gApplication::init(int *argc, char ***argv) | void gApplication::init(int *argc, char ***argv) | |||
{ | { | |||
GtkSettings *settings; | GtkSettings *settings; | |||
appEvents = 0; | appEvents = 0; | |||
gtk_init(argc, argv); | ||||
#ifdef GTK3 | #ifdef GTK3 | |||
_app = gtk_application_new(NULL, G_APPLICATION_FLAGS_NONE); | _app = gtk_application_new(NULL, G_APPLICATION_FLAGS_NONE); | |||
g_object_set(G_OBJECT(_app), "register-session", TRUE, NULL); | g_object_set(G_OBJECT(_app), "register-session", TRUE, NULL); | |||
#else | #else | |||
session_manager_init(argc, argv); | session_manager_init(argc, argv); | |||
g_signal_connect(gnome_master_client(), "save-yourself", G_CALLBACK(maste r_client_save_yourself), NULL); | g_signal_connect(gnome_master_client(), "save-yourself", G_CALLBACK(maste r_client_save_yourself), NULL); | |||
g_signal_connect(gnome_master_client(), "die", G_CALLBACK(master_client_d ie), NULL); | g_signal_connect(gnome_master_client(), "die", G_CALLBACK(master_client_d ie), NULL); | |||
#endif | #endif | |||
getStyleName(); | getStyleName(); | |||
End of changes. 10 change blocks. | ||||
66 lines changed or deleted | 48 lines changed or added |