ChatOK (int n)
{ // can only be called through <Enter> in chat-partner text-edit, as there is no OK button
char buf[MSG_SIZ];
+
if(!partner || strcmp(partner, chatPartner[activePartner])) {
safeStrCpy(chatPartner[activePartner], partner, MSG_SIZ);
SetWidgetText(&chatOptions[5], "", -1); // clear text if we alter partner
void
SetWidgetLabel (Option *opt, char *buf)
{
- gtk_label_set_text(opt->handle, buf);
+ if(opt->type == Button) // Chat window uses this routine for changing button labels
+ gtk_button_set_label(opt->handle, buf);
+ else
+ gtk_label_set_text(opt->handle, buf);
}
void
return menu;
}
-Option *typeIn; // kludge to distinguish type-in callback from input-box callback
+Option *icsBox; // kludge to distinguish type-in callback from input-box callback
void
CursorAtEnd (Option *opt)
}
static gboolean
-ICSKeyEvent(GtkWidget *widget, GdkEventKey *event, gpointer g)
-{
- Option *opt = (Option *) g;
- if(opt == typeIn) {
- if(event->keyval == GDK_Return) {
- char *val;
- GetWidgetText(opt, &val);
- TypeInDoneEvent(val);
- PopDown(TransientDlg);
- return TRUE;
- }
- return FALSE;
- }
-
- switch(event->keyval) {
+ICSKeyEvent (int keyval)
+{ // TODO_GTK: arrow-handling should really be integrated in type-in proc, and this should be a backe-end OK handler
+ switch(keyval) {
case GDK_Return: IcsKey(0); return TRUE;
case GDK_Up: IcsKey(1); return TRUE;
case GDK_Down: IcsKey(-1); return TRUE;
case 0: // history (now uses generic textview callback)
case 1: // comment (likewise)
break;
- case 2: // move type-in
- typeIn = opt;
case 3: // input box
- g_signal_connect(opt->handle, "key-press-event", G_CALLBACK (ICSKeyEvent), (gpointer) opt);
+ icsBox = opt;
+ case 2: // move type-in
+ g_signal_connect(opt->handle, "key-press-event", G_CALLBACK (TypeInProc), (gpointer) (dlg<<16 | (opt - dialogOptions[dlg])));
break;
case 5: // game list
g_signal_connect(opt->handle, "button-press-event", G_CALLBACK (GameListEvent), (gpointer) 0 );
void
HardSetFocus (Option *opt)
{
-#ifdef TODO_GTK
- XSetInputFocus(xDisplay, XtWindow(opt->handle), RevertToPointerRoot, CurrentTime);
-#endif
+ FocusOnWidget(opt, 0); // second arg not used in GDK
}