[<<] [<] Page 1 of 1 [>] [>>] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
Keep pixmap temporarily when GrMoveWindow()!
From: "wang" ####@####.#### Date: 20 Aug 2002 07:14:28 -0000 Message-Id: In former mail,I have suggest we should cache the pixmap for a while when calling GrMoveWindow(),Jordan write: >its a difficult thing to implement,especially without >using much more memory resources that we should (ie, >backing store). Yep,I agree ,if we allocate a pixmap but do not release it ,it should be a great waste of limited memory,so I say we should temporarily keep it ,and if we do not need it ,just release it.this is how I implement so: 1.I difine a new pixmap_buffer structure: typedef struct{ GR_WINDOW_ID pixid; GR_WINDOW_ID winid; time_t call_time; }pixmap_buffer; pixmap_buffer pix_buffer; 2.Every time when we call GrMoveWindow() ,it first look up pix_buffer.pixid,if it's null ,just allocate a pixmap. and set the create time to pix_buffer.call_time. or it's not null(currently not released),but not the window we want cached in it ,just release it and reallocate a pixmap. and set pix_buffer.winid to the id of the window we want move. then do what we have done. however ,if it's not null and the cached window is what we want ,just copy it to the new area. GrMoveWindow() does not releade the pixmap,this is what we should do next step. 3.In every GrSelect() loop ,we check pix_buffer.pixid ,if it's null ,just go ahead ,otherwise ,get current time ,compare with the create time of the pixmap ,if more than 5s(I think a dragging should less than 5s or even less),release the pixmap ,and set all members of pix_buffer to null. By the way I want to make it optional. also if you have enough memory ,you can cache more than one or two windows for dragging or some other use such as expose. Any comments are welcome! wang ####@####.#### 2002-08-20 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
[<<] [<] Page 1 of 1 [>] [>>] |