| ︙ | | | ︙ | |
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
int alt_keycode;
char wintitle[sizeof(((Config *)0)->wintitle)];
char icontitle[sizeof(((Config *)0)->wintitle)];
int master_fd, master_func_id, exited;
void *ldisc;
Backend *back;
void *backhandle;
};
static struct gui_data the_inst;
static struct gui_data *inst = &the_inst; /* so we always write `inst->' */
static int send_raw_mouse;
void ldisc_update(void *frontend, int echo, int edit)
|
>
|
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
int alt_keycode;
char wintitle[sizeof(((Config *)0)->wintitle)];
char icontitle[sizeof(((Config *)0)->wintitle)];
int master_fd, master_func_id, exited;
void *ldisc;
Backend *back;
void *backhandle;
Terminal *term;
};
static struct gui_data the_inst;
static struct gui_data *inst = &the_inst; /* so we always write `inst->' */
static int send_raw_mouse;
void ldisc_update(void *frontend, int echo, int edit)
|
| ︙ | | | ︙ | |
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
|
}
/*
* Refresh the window in response to a server-side request.
*/
void refresh_window(void)
{
term_invalidate(term);
}
/*
* Maximise or restore the window in response to a server-side
* request.
*/
void set_zoomed(int zoomed)
|
|
|
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
|
}
/*
* Refresh the window in response to a server-side request.
*/
void refresh_window(void)
{
term_invalidate(inst->term);
}
/*
* Maximise or restore the window in response to a server-side
* request.
*/
void set_zoomed(int zoomed)
|
| ︙ | | | ︙ | |
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
|
gdk_draw_rectangle(inst->pixmap, gc, 1, 0, 0,
cfg.width * inst->font_width + 2*cfg.window_border,
cfg.height * inst->font_height + 2*cfg.window_border);
gdk_gc_unref(gc);
}
if (need_size) {
term_size(term, h, w, cfg.savelines);
}
return TRUE;
}
gint expose_area(GtkWidget *widget, GdkEventExpose *event, gpointer data)
{
|
|
|
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
|
gdk_draw_rectangle(inst->pixmap, gc, 1, 0, 0,
cfg.width * inst->font_width + 2*cfg.window_border,
cfg.height * inst->font_height + 2*cfg.window_border);
gdk_gc_unref(gc);
}
if (need_size) {
term_size(inst->term, h, w, cfg.savelines);
}
return TRUE;
}
gint expose_area(GtkWidget *widget, GdkEventExpose *event, gpointer data)
{
|
| ︙ | | | ︙ | |
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
|
}
/*
* Shift-PgUp and Shift-PgDn don't even generate keystrokes
* at all.
*/
if (event->keyval == GDK_Page_Up && (event->state & GDK_SHIFT_MASK)) {
term_scroll(term, 0, -cfg.height/2);
return TRUE;
}
if (event->keyval == GDK_Page_Down && (event->state & GDK_SHIFT_MASK)) {
term_scroll(term, 0, +cfg.height/2);
return TRUE;
}
/*
* Neither does Shift-Ins.
*/
if (event->keyval == GDK_Insert && (event->state & GDK_SHIFT_MASK)) {
|
|
|
|
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
|
}
/*
* Shift-PgUp and Shift-PgDn don't even generate keystrokes
* at all.
*/
if (event->keyval == GDK_Page_Up && (event->state & GDK_SHIFT_MASK)) {
term_scroll(inst->term, 0, -cfg.height/2);
return TRUE;
}
if (event->keyval == GDK_Page_Down && (event->state & GDK_SHIFT_MASK)) {
term_scroll(inst->term, 0, +cfg.height/2);
return TRUE;
}
/*
* Neither does Shift-Ins.
*/
if (event->keyval == GDK_Insert && (event->state & GDK_SHIFT_MASK)) {
|
| ︙ | | | ︙ | |
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
|
goto done;
}
}
/*
* Application keypad mode.
*/
if (term->app_keypad_keys && !cfg.no_applic_k) {
int xkey = 0;
switch (event->keyval) {
case GDK_Num_Lock: xkey = 'P'; break;
case GDK_KP_Divide: xkey = 'Q'; break;
case GDK_KP_Multiply: xkey = 'R'; break;
case GDK_KP_Subtract: xkey = 'S'; break;
/*
|
|
|
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
|
goto done;
}
}
/*
* Application keypad mode.
*/
if (inst->term->app_keypad_keys && !cfg.no_applic_k) {
int xkey = 0;
switch (event->keyval) {
case GDK_Num_Lock: xkey = 'P'; break;
case GDK_KP_Divide: xkey = 'Q'; break;
case GDK_KP_Multiply: xkey = 'R'; break;
case GDK_KP_Subtract: xkey = 'S'; break;
/*
|
| ︙ | | | ︙ | |
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
|
case GDK_KP_6: case GDK_KP_Right: xkey = 'v'; break;
case GDK_KP_7: case GDK_KP_Home: xkey = 'w'; break;
case GDK_KP_8: case GDK_KP_Up: xkey = 'x'; break;
case GDK_KP_9: case GDK_KP_Page_Up: xkey = 'y'; break;
case GDK_KP_Decimal: case GDK_KP_Delete: xkey = 'n'; break;
}
if (xkey) {
if (term->vt52_mode) {
if (xkey >= 'P' && xkey <= 'S')
end = 1 + sprintf(output+1, "\033%c", xkey);
else
end = 1 + sprintf(output+1, "\033?%c", xkey);
} else
end = 1 + sprintf(output+1, "\033O%c", xkey);
goto done;
|
|
|
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
|
case GDK_KP_6: case GDK_KP_Right: xkey = 'v'; break;
case GDK_KP_7: case GDK_KP_Home: xkey = 'w'; break;
case GDK_KP_8: case GDK_KP_Up: xkey = 'x'; break;
case GDK_KP_9: case GDK_KP_Page_Up: xkey = 'y'; break;
case GDK_KP_Decimal: case GDK_KP_Delete: xkey = 'n'; break;
}
if (xkey) {
if (inst->term->vt52_mode) {
if (xkey >= 'P' && xkey <= 'S')
end = 1 + sprintf(output+1, "\033%c", xkey);
else
end = 1 + sprintf(output+1, "\033?%c", xkey);
} else
end = 1 + sprintf(output+1, "\033O%c", xkey);
goto done;
|
| ︙ | | | ︙ | |
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
|
code = 6;
break;
}
/* Reorder edit keys to physical order */
if (cfg.funky_type == 3 && code <= 6)
code = "\0\2\1\4\5\3\6"[code];
if (term->vt52_mode && code > 0 && code <= 6) {
end = 1 + sprintf(output+1, "\x1B%c", " HLMEIG"[code]);
goto done;
}
if (cfg.funky_type == 5 && /* SCO function keys */
code >= 11 && code <= 34) {
char codes[] = "MNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz@[\\]^_`{";
|
|
|
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
|
code = 6;
break;
}
/* Reorder edit keys to physical order */
if (cfg.funky_type == 3 && code <= 6)
code = "\0\2\1\4\5\3\6"[code];
if (inst->term->vt52_mode && code > 0 && code <= 6) {
end = 1 + sprintf(output+1, "\x1B%c", " HLMEIG"[code]);
goto done;
}
if (cfg.funky_type == 5 && /* SCO function keys */
code >= 11 && code <= 34) {
char codes[] = "MNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz@[\\]^_`{";
|
| ︙ | | | ︙ | |
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
|
output[1] = '\x7F';
end = 2;
} else {
end = 1 + sprintf(output+1, "\x1B[%c", codes[code-1]);
}
goto done;
}
if ((term->vt52_mode || cfg.funky_type == 4) &&
code >= 11 && code <= 24) {
int offt = 0;
if (code > 15)
offt++;
if (code > 21)
offt++;
if (term->vt52_mode)
end = 1 + sprintf(output+1,
"\x1B%c", code + 'P' - 11 - offt);
else
end = 1 + sprintf(output+1,
"\x1BO%c", code + 'P' - 11 - offt);
goto done;
}
if (cfg.funky_type == 1 && code >= 11 && code <= 15) {
end = 1 + sprintf(output+1, "\x1B[[%c", code + 'A' - 11);
goto done;
}
if (cfg.funky_type == 2 && code >= 11 && code <= 14) {
if (term->vt52_mode)
end = 1 + sprintf(output+1, "\x1B%c", code + 'P' - 11);
else
end = 1 + sprintf(output+1, "\x1BO%c", code + 'P' - 11);
goto done;
}
if (cfg.rxvt_homeend && (code == 1 || code == 4)) {
end = 1 + sprintf(output+1, code == 1 ? "\x1B[H" : "\x1BOw");
|
|
|
|
|
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
|
output[1] = '\x7F';
end = 2;
} else {
end = 1 + sprintf(output+1, "\x1B[%c", codes[code-1]);
}
goto done;
}
if ((inst->term->vt52_mode || cfg.funky_type == 4) &&
code >= 11 && code <= 24) {
int offt = 0;
if (code > 15)
offt++;
if (code > 21)
offt++;
if (inst->term->vt52_mode)
end = 1 + sprintf(output+1,
"\x1B%c", code + 'P' - 11 - offt);
else
end = 1 + sprintf(output+1,
"\x1BO%c", code + 'P' - 11 - offt);
goto done;
}
if (cfg.funky_type == 1 && code >= 11 && code <= 15) {
end = 1 + sprintf(output+1, "\x1B[[%c", code + 'A' - 11);
goto done;
}
if (cfg.funky_type == 2 && code >= 11 && code <= 14) {
if (inst->term->vt52_mode)
end = 1 + sprintf(output+1, "\x1B%c", code + 'P' - 11);
else
end = 1 + sprintf(output+1, "\x1BO%c", code + 'P' - 11);
goto done;
}
if (cfg.rxvt_homeend && (code == 1 || code == 4)) {
end = 1 + sprintf(output+1, code == 1 ? "\x1B[H" : "\x1BOw");
|
| ︙ | | | ︙ | |
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
|
}
if (xkey) {
/*
* The arrow keys normally do ESC [ A and so on. In
* app cursor keys mode they do ESC O A instead.
* Ctrl toggles the two modes.
*/
if (term->vt52_mode) {
end = 1 + sprintf(output+1, "\033%c", xkey);
} else if (!term->app_cursor_keys ^
!(event->state & GDK_CONTROL_MASK)) {
end = 1 + sprintf(output+1, "\033O%c", xkey);
} else {
end = 1 + sprintf(output+1, "\033[%c", xkey);
}
goto done;
}
|
|
|
|
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
|
}
if (xkey) {
/*
* The arrow keys normally do ESC [ A and so on. In
* app cursor keys mode they do ESC O A instead.
* Ctrl toggles the two modes.
*/
if (inst->term->vt52_mode) {
end = 1 + sprintf(output+1, "\033%c", xkey);
} else if (!inst->term->app_cursor_keys ^
!(event->state & GDK_CONTROL_MASK)) {
end = 1 + sprintf(output+1, "\033O%c", xkey);
} else {
end = 1 + sprintf(output+1, "\033[%c", xkey);
}
goto done;
}
|
| ︙ | | | ︙ | |
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
|
for (i = start; i < end; i++)
printf(" %02x", (unsigned char) output[i]);
printf("\n");
#endif
ldisc_send(inst->ldisc, output+start, end-start, 1);
show_mouseptr(0);
term_seen_key_event(term);
term_out(term);
}
return TRUE;
}
gint button_event(GtkWidget *widget, GdkEventButton *event, gpointer data)
{
struct gui_data *inst = (struct gui_data *)data;
int shift, ctrl, alt, x, y, button, act;
show_mouseptr(1);
if (event->button == 4 && event->type == GDK_BUTTON_PRESS) {
term_scroll(term, 0, -5);
return TRUE;
}
if (event->button == 5 && event->type == GDK_BUTTON_PRESS) {
term_scroll(term, 0, +5);
return TRUE;
}
shift = event->state & GDK_SHIFT_MASK;
ctrl = event->state & GDK_CONTROL_MASK;
alt = event->state & GDK_MOD1_MASK;
if (event->button == 1)
|
|
|
|
|
|
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
|
for (i = start; i < end; i++)
printf(" %02x", (unsigned char) output[i]);
printf("\n");
#endif
ldisc_send(inst->ldisc, output+start, end-start, 1);
show_mouseptr(0);
term_seen_key_event(inst->term);
term_out(inst->term);
}
return TRUE;
}
gint button_event(GtkWidget *widget, GdkEventButton *event, gpointer data)
{
struct gui_data *inst = (struct gui_data *)data;
int shift, ctrl, alt, x, y, button, act;
show_mouseptr(1);
if (event->button == 4 && event->type == GDK_BUTTON_PRESS) {
term_scroll(inst->term, 0, -5);
return TRUE;
}
if (event->button == 5 && event->type == GDK_BUTTON_PRESS) {
term_scroll(inst->term, 0, +5);
return TRUE;
}
shift = event->state & GDK_SHIFT_MASK;
ctrl = event->state & GDK_CONTROL_MASK;
alt = event->state & GDK_MOD1_MASK;
if (event->button == 1)
|
| ︙ | | | ︙ | |
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
|
if (send_raw_mouse && !(cfg.mouse_override && shift) &&
act != MA_CLICK && act != MA_RELEASE)
return TRUE; /* we ignore these in raw mouse mode */
x = (event->x - cfg.window_border) / inst->font_width;
y = (event->y - cfg.window_border) / inst->font_height;
term_mouse(term, button, act, x, y, shift, ctrl, alt);
return TRUE;
}
gint motion_event(GtkWidget *widget, GdkEventMotion *event, gpointer data)
{
struct gui_data *inst = (struct gui_data *)data;
|
|
|
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
|
if (send_raw_mouse && !(cfg.mouse_override && shift) &&
act != MA_CLICK && act != MA_RELEASE)
return TRUE; /* we ignore these in raw mouse mode */
x = (event->x - cfg.window_border) / inst->font_width;
y = (event->y - cfg.window_border) / inst->font_height;
term_mouse(inst->term, button, act, x, y, shift, ctrl, alt);
return TRUE;
}
gint motion_event(GtkWidget *widget, GdkEventMotion *event, gpointer data)
{
struct gui_data *inst = (struct gui_data *)data;
|
| ︙ | | | ︙ | |
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
|
button = MBT_RIGHT;
else
return FALSE; /* don't even know what button! */
x = (event->x - cfg.window_border) / inst->font_width;
y = (event->y - cfg.window_border) / inst->font_height;
term_mouse(term, button, MA_DRAG, x, y, shift, ctrl, alt);
return TRUE;
}
void done_with_pty(struct gui_data *inst)
{
extern void pty_close(void);
|
|
|
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
|
button = MBT_RIGHT;
else
return FALSE; /* don't even know what button! */
x = (event->x - cfg.window_border) / inst->font_width;
y = (event->y - cfg.window_border) / inst->font_height;
term_mouse(inst->term, button, MA_DRAG, x, y, shift, ctrl, alt);
return TRUE;
}
void done_with_pty(struct gui_data *inst)
{
extern void pty_close(void);
|
| ︙ | | | ︙ | |
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
|
sprintf(message, "\r\n[pterm: process terminated on signal"
" %d]\r\n", WTERMSIG(exitcode));
#else
sprintf(message, "\r\n[pterm: process terminated on signal"
" %d (%.400s)]\r\n", WTERMSIG(exitcode),
strsignal(WTERMSIG(exitcode)));
#endif
from_backend((void *)term, 0, message, strlen(message));
}
inst->exited = 1;
}
}
void frontend_keypress(void *handle)
{
|
|
|
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
|
sprintf(message, "\r\n[pterm: process terminated on signal"
" %d]\r\n", WTERMSIG(exitcode));
#else
sprintf(message, "\r\n[pterm: process terminated on signal"
" %d (%.400s)]\r\n", WTERMSIG(exitcode),
strsignal(WTERMSIG(exitcode)));
#endif
from_backend((void *)inst->term, 0, message, strlen(message));
}
inst->exited = 1;
}
}
void frontend_keypress(void *handle)
{
|
| ︙ | | | ︙ | |
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
|
* (though we don't necessarily _close_ the window,
* depending on the state of Close On Exit). This would be
* easy enough to change or make configurable if necessary.
*/
done_with_pty(inst);
}
term_update(term);
term_blink(term, 0);
return TRUE;
}
void pty_input_func(gpointer data, gint sourcefd, GdkInputCondition condition)
{
struct gui_data *inst = (struct gui_data *)data;
char buf[4096];
|
|
|
|
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
|
* (though we don't necessarily _close_ the window,
* depending on the state of Close On Exit). This would be
* easy enough to change or make configurable if necessary.
*/
done_with_pty(inst);
}
term_update(inst->term);
term_blink(inst->term, 0);
return TRUE;
}
void pty_input_func(gpointer data, gint sourcefd, GdkInputCondition condition)
{
struct gui_data *inst = (struct gui_data *)data;
char buf[4096];
|
| ︙ | | | ︙ | |
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
|
*/
if (ret == 0 || (ret < 0 && errno == EIO)) {
done_with_pty(inst);
} else if (ret < 0) {
perror("read pty master");
exit(1);
} else if (ret > 0)
from_backend(term, 0, buf, ret);
term_blink(term, 1);
term_out(term);
}
void destroy(GtkWidget *widget, gpointer data)
{
gtk_main_quit();
}
gint focus_event(GtkWidget *widget, GdkEventFocus *event, gpointer data)
{
term->has_focus = event->in;
term_out(term);
term_update(term);
show_mouseptr(1);
return FALSE;
}
/*
* set or clear the "raw mouse message" mode
*/
|
|
|
|
|
|
|
|
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
|
*/
if (ret == 0 || (ret < 0 && errno == EIO)) {
done_with_pty(inst);
} else if (ret < 0) {
perror("read pty master");
exit(1);
} else if (ret > 0)
from_backend(inst->term, 0, buf, ret);
term_blink(inst->term, 1);
term_out(inst->term);
}
void destroy(GtkWidget *widget, gpointer data)
{
gtk_main_quit();
}
gint focus_event(GtkWidget *widget, GdkEventFocus *event, gpointer data)
{
inst->term->has_focus = event->in;
term_out(inst->term);
term_update(inst->term);
show_mouseptr(1);
return FALSE;
}
/*
* set or clear the "raw mouse message" mode
*/
|
| ︙ | | | ︙ | |
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
|
gtk_selection_data_set(seldata, GDK_SELECTION_TYPE_STRING, 8,
inst->pasteout_data, inst->pasteout_data_len);
}
gint selection_clear(GtkWidget *widget, GdkEventSelection *seldata,
gpointer data)
{
term_deselect(term);
if (inst->pasteout_data)
sfree(inst->pasteout_data);
inst->pasteout_data = NULL;
inst->pasteout_data_len = 0;
return TRUE;
}
|
|
|
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
|
gtk_selection_data_set(seldata, GDK_SELECTION_TYPE_STRING, 8,
inst->pasteout_data, inst->pasteout_data_len);
}
gint selection_clear(GtkWidget *widget, GdkEventSelection *seldata,
gpointer data)
{
term_deselect(inst->term);
if (inst->pasteout_data)
sfree(inst->pasteout_data);
inst->pasteout_data = NULL;
inst->pasteout_data_len = 0;
return TRUE;
}
|
| ︙ | | | ︙ | |
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
|
sfree(inst->pastein_data);
inst->pastein_data = smalloc(seldata->length * sizeof(wchar_t));
inst->pastein_data_len = seldata->length;
mb_to_wc(0, 0, seldata->data, seldata->length,
inst->pastein_data, inst->pastein_data_len);
term_do_paste(term);
if (term_paste_pending(term))
inst->term_paste_idle_id = gtk_idle_add(idle_paste_func, inst);
}
gint idle_paste_func(gpointer data)
{
struct gui_data *inst = (struct gui_data *)data;
if (term_paste_pending(term))
term_paste(term);
else
gtk_idle_remove(inst->term_paste_idle_id);
return TRUE;
}
|
|
|
|
|
|
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
|
sfree(inst->pastein_data);
inst->pastein_data = smalloc(seldata->length * sizeof(wchar_t));
inst->pastein_data_len = seldata->length;
mb_to_wc(0, 0, seldata->data, seldata->length,
inst->pastein_data, inst->pastein_data_len);
term_do_paste(inst->term);
if (term_paste_pending(inst->term))
inst->term_paste_idle_id = gtk_idle_add(idle_paste_func, inst);
}
gint idle_paste_func(gpointer data)
{
struct gui_data *inst = (struct gui_data *)data;
if (term_paste_pending(inst->term))
term_paste(inst->term);
else
gtk_idle_remove(inst->term_paste_idle_id);
return TRUE;
}
|
| ︙ | | | ︙ | |
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
|
}
void scrollbar_moved(GtkAdjustment *adj, gpointer data)
{
if (!cfg.scrollbar)
return;
if (!inst->ignore_sbar)
term_scroll(term, 1, (int)adj->value);
}
void sys_cursor(int x, int y)
{
/*
* This is meaningless under X.
*/
|
|
|
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
|
}
void scrollbar_moved(GtkAdjustment *adj, gpointer data)
{
if (!cfg.scrollbar)
return;
if (!inst->ignore_sbar)
term_scroll(inst->term, 1, (int)adj->value);
}
void sys_cursor(int x, int y)
{
/*
* This is meaningless under X.
*/
|
| ︙ | | | ︙ | |
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
|
fontid = 1;
else
shadow = 1;
}
if (lattr != LATTR_NORM) {
x *= 2;
if (x >= term->cols)
return;
if (x + len*2 > term->cols)
len = (term->cols-x)/2; /* trim to LH half */
}
gdk_gc_set_foreground(gc, &inst->cols[nbg]);
gdk_draw_rectangle(inst->pixmap, gc, 1,
x*inst->font_width+cfg.window_border,
y*inst->font_height+cfg.window_border,
len*inst->font_width, inst->font_height);
|
|
|
|
|
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
|
fontid = 1;
else
shadow = 1;
}
if (lattr != LATTR_NORM) {
x *= 2;
if (x >= inst->term->cols)
return;
if (x + len*2 > inst->term->cols)
len = (inst->term->cols-x)/2; /* trim to LH half */
}
gdk_gc_set_foreground(gc, &inst->cols[nbg]);
gdk_draw_rectangle(inst->pixmap, gc, 1,
x*inst->font_width+cfg.window_border,
y*inst->font_height+cfg.window_border,
len*inst->font_width, inst->font_height);
|
| ︙ | | | ︙ | |
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
|
{
GdkGC *gc = (GdkGC *)ctx;
do_text_internal(ctx, x, y, text, len, attr, lattr);
if (lattr != LATTR_NORM) {
x *= 2;
if (x >= term->cols)
return;
if (x + len*2 > term->cols)
len = (term->cols-x)/2; /* trim to LH half */
len *= 2;
}
gdk_draw_pixmap(inst->area->window, gc, inst->pixmap,
x*inst->font_width+cfg.window_border,
y*inst->font_height+cfg.window_border,
x*inst->font_width+cfg.window_border,
|
|
|
|
|
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
|
{
GdkGC *gc = (GdkGC *)ctx;
do_text_internal(ctx, x, y, text, len, attr, lattr);
if (lattr != LATTR_NORM) {
x *= 2;
if (x >= inst->term->cols)
return;
if (x + len*2 > inst->term->cols)
len = (inst->term->cols-x)/2; /* trim to LH half */
len *= 2;
}
gdk_draw_pixmap(inst->area->window, gc, inst->pixmap,
x*inst->font_width+cfg.window_border,
y*inst->font_height+cfg.window_border,
x*inst->font_width+cfg.window_border,
|
| ︙ | | | ︙ | |
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
|
if ((attr & TATTR_ACTCURS) && cfg.cursor_type != 0) {
attr &= ~TATTR_ACTCURS;
}
do_text_internal(ctx, x, y, text, len, attr, lattr);
if (lattr != LATTR_NORM) {
x *= 2;
if (x >= term->cols)
return;
if (x + len*2 > term->cols)
len = (term->cols-x)/2; /* trim to LH half */
len *= 2;
}
if (cfg.cursor_type == 0) {
/*
* An active block cursor will already have been done by
* the above do_text call, so we only need to do anything
|
|
|
|
|
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
|
if ((attr & TATTR_ACTCURS) && cfg.cursor_type != 0) {
attr &= ~TATTR_ACTCURS;
}
do_text_internal(ctx, x, y, text, len, attr, lattr);
if (lattr != LATTR_NORM) {
x *= 2;
if (x >= inst->term->cols)
return;
if (x + len*2 > inst->term->cols)
len = (inst->term->cols-x)/2; /* trim to LH half */
len *= 2;
}
if (cfg.cursor_type == 0) {
/*
* An active block cursor will already have been done by
* the above do_text call, so we only need to do anything
|
| ︙ | | | ︙ | |
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
|
inst->textcursor = make_mouse_ptr(GDK_XTERM);
inst->rawcursor = make_mouse_ptr(GDK_LEFT_PTR);
inst->blankcursor = make_mouse_ptr(-1);
make_mouse_ptr(-2); /* clean up cursor font */
inst->currcursor = inst->textcursor;
show_mouseptr(1);
term = term_init();
inst->back = &pty_backend;
inst->back->init((void *)term, &inst->backhandle, NULL, 0, NULL, 0);
term_provide_resize_fn(term, inst->back->size, inst->backhandle);
term_size(term, cfg.height, cfg.width, cfg.savelines);
inst->ldisc = ldisc_create(term, inst->back, inst->backhandle, inst);
ldisc_send(inst->ldisc, NULL, 0, 0);/* cause ldisc to notice changes */
inst->master_fd = pty_master_fd;
inst->exited = FALSE;
inst->master_func_id = gdk_input_add(pty_master_fd, GDK_INPUT_READ,
pty_input_func, inst);
gtk_main();
return 0;
}
|
|
|
|
|
|
|
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
|
inst->textcursor = make_mouse_ptr(GDK_XTERM);
inst->rawcursor = make_mouse_ptr(GDK_LEFT_PTR);
inst->blankcursor = make_mouse_ptr(-1);
make_mouse_ptr(-2); /* clean up cursor font */
inst->currcursor = inst->textcursor;
show_mouseptr(1);
inst->term = term_init();
inst->back = &pty_backend;
inst->back->init((void *)inst->term, &inst->backhandle, NULL, 0, NULL, 0);
term_provide_resize_fn(inst->term, inst->back->size, inst->backhandle);
term_size(inst->term, cfg.height, cfg.width, cfg.savelines);
inst->ldisc = ldisc_create(inst->term, inst->back, inst->backhandle, inst);
ldisc_send(inst->ldisc, NULL, 0, 0);/* cause ldisc to notice changes */
inst->master_fd = pty_master_fd;
inst->exited = FALSE;
inst->master_func_id = gdk_input_add(pty_master_fd, GDK_INPUT_READ,
pty_input_func, inst);
gtk_main();
return 0;
}
|