Annotation of freem/src/mwapi_window.c, revision 1.4
1.1 snw 1: /*
1.4 ! snw 2: * $Id: mwapi_window.c,v 1.3 2025/03/09 19:50:47 snw Exp $
1.1 snw 3: * mwapi window support
4: *
5: *
1.2 snw 6: * Author: Serena Willis <snw@coherent-logic.com>
1.1 snw 7: * Copyright (C) 1998 MUG Deutschland
1.3 snw 8: * Copyright (C) 2014, 2020, 2021, 2025 Coherent Logic Development LLC
1.1 snw 9: *
10: *
11: * This file is part of FreeM.
12: *
13: * FreeM is free software: you can redistribute it and/or modify
14: * it under the terms of the GNU Affero Public License as published by
15: * the Free Software Foundation, either version 3 of the License, or
16: * (at your option) any later version.
17: *
18: * FreeM is distributed in the hope that it will be useful,
19: * but WITHOUT ANY WARRANTY; without even the implied warranty of
20: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21: * GNU Affero Public License for more details.
22: *
23: * You should have received a copy of the GNU Affero Public License
24: * along with FreeM. If not, see <https://www.gnu.org/licenses/>.
25: *
1.4 ! snw 26: * $Log: mwapi_window.c,v $
! 27: * Revision 1.3 2025/03/09 19:50:47 snw
! 28: * Second phase of REUSE compliance and header reformat
! 29: *
1.3 snw 30: *
31: * SPDX-FileCopyrightText: (C) 2025 Coherent Logic Development LLC
32: * SPDX-License-Identifier: AGPL-3.0-or-later
1.1 snw 33: **/
34:
35: #include "config.h"
36:
37: #if defined(HAVE_MWAPI_MOTIF)
38:
39: #include <stdlib.h>
40:
41: #include "mpsdef0.h"
42: #include "mwapi_window.h"
43: #include "mwapi_event.h"
44:
45: mwapi_window *mwapi_win_head;
46:
47: void mwapi_foreach(void (*callback)(mwapi_window *))
48: {
49: mwapi_window *t;
50:
51: for (t = mwapi_win_head; t != NULL; t = t->next) {
52: (*callback)(t);
53: }
54: }
55:
56: int mwapi_win_count(void)
57: {
58: mwapi_window *t;
59: int c = 0;
60:
61: for (t = mwapi_win_head; t != NULL; t = t->next) c++;
62:
63: return c;
64: }
65:
66:
67: void mwapi_win_show_all(void)
68: {
69: mwapi_foreach (&mwapi_win_show);
70: }
71:
72: void mwapi_win_show(mwapi_window *win)
73: {
74:
75: if (!win->win_visible) {
76:
77: mwapi_event *destroy_ev = mwapi_event_new ("CLOSE", win->window_name, win->window);
78: mwapi_wire_event (destroy_ev, "CLOSE^%MWAPI.EVENT.DEFAULT");
79:
1.4 ! snw 80: /* gtk_widget_show_all (win->window); */
1.1 snw 81:
82: win->win_visible = TRUE;
83:
84: }
85:
86: return;
87: }
88:
89: mwapi_window *mwapi_win_get(char *window_name)
90: {
91:
92: mwapi_window *t;
93:
94: for (t = mwapi_win_head; t != NULL; t = t->next) {
95:
96: if (stcmp (t->window_name, window_name) == 0) {
97: return t;
98: }
99:
100: }
101:
102: /* this window does not yet exist. create it. */
103: t = (mwapi_window *) malloc (sizeof (mwapi_window));
104: NULLPTRCHK(t,"win_get");
105:
106: stcpy (t->window_name, window_name);
107:
1.4 ! snw 108: /* t->window = gtk_window_new (GTK_WINDOW_TOPLEVEL); */
1.1 snw 109: t->win_visible = FALSE;
110:
111: t->next = mwapi_win_head;
112: mwapi_win_head = t;
113:
114: return t;
115:
116: }
117: #endif
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>