Changeset 03ca005 for popwin.c


Ignore:
Timestamp:
Sep 18, 2010, 5:07:39 PM (11 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.7, release-1.8, release-1.9
Children:
61c1f19
Parents:
b3b1b05
git-author:
David Benjamin <davidben@mit.edu> (08/01/10 13:50:19)
git-committer:
David Benjamin <davidben@mit.edu> (09/18/10 17:07:39)
Message:
Create a new owl_popwin every time instead of rewiring the old one

Constantly rewiring things is weird.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • popwin.c

    rb3b1b05 r03ca005  
    11#include "owl.h"
    22
    3 int owl_popwin_init(owl_popwin *pw)
     3owl_popwin *owl_popwin_new(void)
    44{
    5   pw->active=0;
    6   return(0);
    7 }
     5  owl_popwin *pw = owl_malloc(sizeof(owl_popwin));
     6  memset(pw, 0, sizeof(*pw));
    87
    9 int owl_popwin_up(owl_popwin *pw)
    10 {
    11   if (pw->active)
    12     return 1;
    138  pw->border = owl_window_new(NULL);
    149  pw->content = owl_window_new(pw->border);
     
    2318  owl_popwin_size_border(owl_window_get_screen(), pw->border);
    2419
    25   owl_window_show_all(pw->border);
     20  owl_window_show(pw->content);
    2621
    27   pw->active=1;
    28   return(0);
     22  return pw;
     23}
     24
     25int owl_popwin_up(owl_popwin *pw)
     26{
     27  if (owl_window_is_shown(pw->border))
     28    return 1;
     29  owl_window_show(pw->border);
     30  return 0;
    2931}
    3032
     
    7476int owl_popwin_close(owl_popwin *pw)
    7577{
    76   if (!pw->active)
     78  if (!owl_window_is_shown(pw->border))
    7779    return 1;
     80  owl_window_hide(pw->border);
     81  return 0;
     82}
     83
     84void owl_popwin_delete(owl_popwin *pw)
     85{
     86  owl_popwin_close(pw);
     87
     88  /* Remove everything that references us. */
    7889  g_signal_handler_disconnect(pw->border, pw->sig_resize_id);
    7990  g_signal_handler_disconnect(pw->border, pw->sig_redraw_id);
     
    8293  g_object_unref(pw->content);
    8394
    84   pw->border = 0;
    85   pw->content = 0;
    86   pw->active=0;
    87   return(0);
     95  owl_free(pw);
    8896}
    8997
    9098int owl_popwin_is_active(const owl_popwin *pw)
    9199{
    92   return pw->active;
     100  return owl_window_is_shown(pw->border);
    93101}
    94102
Note: See TracChangeset for help on using the changeset viewer.